in reply to Printing the last few elements of an array.
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Printing the last few elements of an array.
by jonnyfolk (Vicar) on Dec 16, 2002 at 19:42 UTC | |
by dakkar (Hermit) on Dec 19, 2002 at 09:07 UTC | |
by jonnyfolk (Vicar) on Dec 20, 2002 at 00:02 UTC |
In Section
Seekers of Perl Wisdom