SPUG: undef a list of variables?

David Bitseff dbitsef at uswest.com
Tue Aug 24 17:25:50 CDT 1999


If you mean a list you can clear a list with '@list = ();'.  You can
also use undef on a list 'undef @list;' If you mean scalars in a list,
you could put use a foreach loop and then undef each of them:

----------------------

for (@scalars_list)
{  undef $_ }

---------------------
or
----------------------------------

for ($scalar1, $scalar2, $scalar3)
{ undef $_ }

----------------------------------

You can also assign undef to a variable '$_ = undef;' I'm not sure why
you would want to do this between method calls on a blessed variable.
Are you using the strict pragma?



>>>>> On Tue XXIV Aug MCMXCIX XII:XIX:LVII, Michael Leary writes:

Michael> Anyone know a nifty way to undef a list of variables?  
Michael> I'm trying to keep my package namespace clean between method calls.


-- 
David Bitseff
U S WEST Creative Services
dbitsef at uswest.com         
(206) 346-9279

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    POST TO: spug-list at pm.org        PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
        Email to majordomo at pm.org: ACTION spug-list your_address





More information about the spug-list mailing list