in reply to infinite loop on while (@array)

Assuming the loop variable is the current element of array you can use the following form of for(each) that will alias $_ to the actual variable and change it all you want. Just make sure it's a variable and not a list literal like for(1..10)
#!/usr/bin/perl -w use strict; my @array = (1..15); print "Numbers are ",join(", ",@array),"\n"; foreach(@array){ next if $_ % 2; # Skip odd numbers. last if $_ > 10; # Exit loop prematurely. $_ = $_ * 2; } print "Numbers now ",join(", ",@array),"\n";


-Lee

"To be civilized is to deny one's nature."