undef()-fing multiple items at once 
Author Message
 undef()-fing multiple items at once

It is one of the annoying features of undef(), that it will work only on
one item at once. So this won't work:


You "must" do this instead:

        undef $name; undef $age; undef $value; undef $path;

which looks rather annoying.

But there is an alternative:

        ($name, $age, $value, $pat) = ();

Every scalar will be assigned the undefined value. It kinda works for
arrays and hashes too: it will assign the empty list to arrays and
hashes, which is, for most practical purposes, more than adequate.


Wed, 18 Jun 1902 08:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. How to undef many vars at once

2. select($rout,undef,undef,undef) not working (always returns)

3. select( undef, undef, undef, 1.5) under WinNT

4. Multiple dbmopen()'s at once (perl4)

5. How to do multiple files at once?

6. comment out multiple lines at once

7. How to upload multiple graphic files at once ?

8. How to upload multiple graphic files at once ?

9. Retrieving multiple hash elements at once

10. Possible Bug: Multiple DBM Files at once

11. Undef'ing multiple variables

12. undef multiple variables


Powered by phpBB® Forum Software