Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Loop Quandaryby Crackers2 (Parson) |
on Nov 21, 2013 at 19:03 UTC ( [id://1063782]=note: print w/replies, xml ) | Need Help?? |
My guess is in the first loop the match happens on the same string each time, so you'll find each a in turn then exit the loop In the second example, you call InfStr on every cycle of the loop, which makes it a regex against a new string, so it'll find the first a in the string each time and never progress (Update: You can see this more clearly if you use (.) instead of (a) for the match; first loop will go through each letter, second on will always find the first a)
In Section
Seekers of Perl Wisdom
|
|