Also, if you want to do surgery on your array, look at splice.use strict; use warnings; use Data::Dumper (); my @rocks = (); $rocks[0] = 'bedrock'; $rocks[1] = 'slate'; $rocks[2]= 'lava'; $rocks[3] = 'crushed rock'; print Data::Dumper::Dumper(\@rocks); $rocks[99] = 'schist'; print Data::Dumper::Dumper(\@rocks); $#rocks = 2; # forget all rocks after 'lava' print Data::Dumper::Dumper(\@rocks); $#rocks = 99; # add 97 undef e print Data::Dumper::Dumper(\@rocks);
In reply to Re: What's going on in array element assignment?
by perlfan
in thread What's going on in array element assignment?
by zapdos
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |