Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: undef'ing @arrays caveat

by Juerd (Abbot)
on Apr 20, 2002 at 09:52 UTC ( #160759=note: print w/replies, xml ) Need Help??


in reply to undef'ing @arrays caveat

You can only assign lists to arrays, but what you probably forgot is that not all lists need parentheses. So effectively, this happens:

@array = (undef);
It makes your array be a single element array with undef as its only value. To empty an array, use an empty list (because there is no scalar this time, you need the parens):
@array = ();
To really destroy the array, and also reset its MAX, use:
undef @array;
See also: undef.

- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://160759]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2023-10-04 04:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?