in reply to
Re: Foreach Loops
in thread
Foreach Loops
And, of course, the previous line is available at
$arr[$x - 1]
(unless we're talking $x == 0)
Comment on
Re^2: Foreach Loops
Download
Code
Replies are listed 'Best First'.
Re^3: Foreach Loops
by
Anonymous Monk
on Mar 16, 2005 at 15:19 UTC
Well, if you consider arrays to be circular, if
$x == 0
, then
$arr[$x - 1]
is the last element. Which would be just right. Unfortunally, it doesn't work the way.
$arr[$#arr + 1]
isn't the same as
$arr[0]
.
[reply]
[d/l]
[select]
In Section
Seekers of Perl Wisdom