The stupid question is the question not asked | |
PerlMonks |
Re: Printing the last few elements of an array.by dakkar (Hermit) |
on Dec 16, 2002 at 17:29 UTC ( [id://220281]=note: print w/replies, xml ) | Need Help?? |
About 'the question you asked' in the second snippet: you got out a number, repeated 5 times, right? This is because you wrote $line=@record, which means: assign to $line the number of elements in the array @record. This happens because assigning to a scalar variables sets scalar context for the right-hand side of the assignment, and an array in scalar context evaluates to its lenght. -- dakkar - Mobilis in mobile
In Section
Seekers of Perl Wisdom
|
|