The "at-sign" sigil (@) is used when you refer to two or more elements of an array. If you are accessing (or referring to) a single element of an array, then the "dollar-sign" ($) sigil is used.
For example:
my @foo = qw/a b c/; print "$foo[1]\n"; # Prints b print "@foo\n"; # Prints a b c print "$foo[$#foo]\n"; # Prints c (but you would probably never do th +is) print "$foo[-1]\n"; # Also prints c (a better way than the previou +s) print "@foo[0,2]\n"; # Prints a c
Cheers,
Darren :)
In reply to Re^3: reading file into an array
by McDarren
in thread reading file into an array
by vassago
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |