Here is another attempt at making this readable and small ..(And , hopefully, correct)
Update:Noticed and Fixed Bug: Changed <= to <, @a[[$i]] to @a[[$i+1]].my @a=qw( wilma fred barney betty pebbels dino ); for (my ($i,$p,$c,$n)=(0,undef,@a); $i < scalar @a; $i++,($p,$c,$n) = ($c,$n,$a[$i+1])){ print qq($i Prev=$p \tCurr=$c \tNext=$n\n) } -- Output -- 0 Prev= Curr=wilma Next=fred 1 Prev=wilma Curr=fred Next=barney 2 Prev=fred Curr=barney Next=betty 3 Prev=barney Curr=betty Next=pebbels 4 Prev=betty Curr=pebbels Next=dino 5 Prev=pebbels Curr=dino Next=
In reply to Re: Re: Getting the next array element while still keeping the current one
by NetWallah
By guaranteeing freedom of expression, the First Amendment also guarntees offense.
in thread Getting the next array element while still keeping the current one
by Anonymous Monk
For:
Use:
& & < < > > [ [ ] ]