in reply to infinite loop on while (@array)

The reason why I'm not using for or foreach is because I need to change the loop control variable...

foreach my $foo (@bar) {...} works just as while my $baz (@quux) { } does. perldoc perlsyn