my %stacks; my $CurrentArrayRef = $Stacks{nonexistant} || []; # Line above CREATES a ref to an empty array if the stack was undefine +d. #It returns a ref to the contents if there were any. push @$CurrentArrayRef, "New Value"; ... more code ... # Now (re)store the contents into the stack $Stacks{nonexistant} = $CurrentArrayRef;
"Income tax returns are the most imaginative fiction being written today." -- Herman Wouk
In reply to Re: creating defined references to arrays of size zero
by NetWallah
in thread creating defined references to arrays of size zero
by spieper
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |