#!/app/geneva/perl/bin/perl @x = (); $x[10] = 1; @x[1..3] = 1; for($y=0; $y!=@x; $y++) { if(exists($x[$y])) { print "$y exists"; } if(defined($x[$y])) { print "\t$y defined"; } print "\n"; } Gives the following output: 1 exists 1 defined 2 exists 3 exists 10 exists 10 defined
In reply to Initialization of arrays by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |