P is for Practical | |
PerlMonks |
Re: A new perl {cough} feature?by chipmunk (Parson) |
on Feb 18, 2002 at 05:17 UTC ( [id://146103]=note: print w/replies, xml ) | Need Help?? |
The answers are:
1) Perl has a special value for undef, called SV_UNDEF. Rather than create a separate 'undef' for each uninitialized value, Perl stores a pointer to this special undef value. Thus, the output from Data::Dumper is, in a way, correct; all of the uninitialized array elements are pointing to the same value, SV_UNDEF. 2) Auto-vivification. grep { 1 } @$_ for @matrix; treats each element of @matrix as an array reference, so the uninitialized elements are autovivified.
In Section
Seekers of Perl Wisdom
|
|