in reply to Four or five ways we can make or break an array?

@$array = (1, 2, 3);  what?!

Treat $array as an array reference, and assign the list to that array.

If $array already points to an array, overwrite that array with the list.

If $array is undef, create (autovivify) an array and assign a reference to it to $array.

If $array currently has any value other than undef or an array reference, and strict is in force, die.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"I'd rather go naked than blow up my ass"

Replies are listed 'Best First'.
Re^2: Four or five ways we can make or break an array?
by theantler (Beadle) on Mar 20, 2010 at 12:57 UTC
    OK .. I didnt know it would be a bad thing mention .. Sorry!