On May 31, 10:15 am, [EMAIL PROTECTED] (Sharan Basappa) wrote: > Thanks a lot Paul .. > > For this rule : > $str = mississippi; > $str =~ m/m(.*i)(.*pi)/; > > My initial understanding was that .*i would match all the way till last char > i.
> This would indeed be true if .*i was not followed by .*pi. > Do you agree ? Yes. Like you said initially - a regexp quantifier will match as much as possible WITHOUT PREVENING THE MATCH FROM SUCEEDING. If the .*i matched all the way up until the very last i, then the .*pi would fail because there'd be nothing left to match. FWIW, you can add: use re 'debug'; to the top of your script to see exactly what Perl does when trying to match a regexp. You'll see in this case that it first tries to let .*i match all the way to the end, but then finds that .*pi now fails, so it backtracks, letting the .* part of .*i match less and less until .*pi can also match. Paul Lalli -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/