Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
you need square brackets...
The square bracket returns a reference to an anonymous array. Your example is just a list, which is forced to scalar context (you're putting it into the first element of your array) which just returns the last element in your list. You can prove this by printing $arr[0]; You might also have noticed I changed the @'s to $'s, which it prefered when referencing a single element of an array... If you run your program with warnings on, it will tell you this. references are a big subject, you might want to check out ... or "Learing/Programming Perl" which are excellent books.
--- my name's not Keith, and I'm not reasonable. In reply to Re: 2 dimensional array question
by reasonablekeith
|
|