in reply to resetting a loop

i reformatted the code, sorry if it's confusing
foreach my $No (@Nos){ push(@String, $Chains{$chain}{$No}) ; $prevNo = $No; shift(@Nos); print "@Nos\n"; }