On Saturday 30 October 2010 01:26 PM, Uri Guttman wrote:
but you missed the important point. the engine will stop but the next
time through the loop it will START at the beginning of the
string. hence the infinite loop.
[Jatin] Thanks Uri , This is a very important point that you have
mentioned. Thanks for this small but very fundamental piece of information.
wrong. in this case in scalar context, it does stop after a match. the
difference is that the starting point for the NEXT loop will be after
the match. so it will keep matching until the end of the string. hence,
it will always stop and no infinite loop.
[Jatin] And hence /g is needed to stop the matching when the matching is
used in scalar context.
what i said above. you have read about /g in list context, but not in
scalar context. read the docs again and carefully look for the context.
[Jatin] Sure , I will again get back to the docs :)
uri
Thanks Uri , Thanks for correcting and making me understand the basics.
Thanks
Jatin
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/