dippa wrote: > > Trying to work out why: > 1. the for loop does not work, want the same logic as the while loop > 2. for(my $pos = -1; $pos == -1; $pos++) only iterates through once > 3. for(my $pos = 0; $pos == -1; $pos++) does not enter loop at all
Because in both cases your while condition is that $pos == -1. When it is initially set to -1 the condition is satisfied just once on entry. When initially set to 0 it is never satisfied. Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/