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=