I have a script as follows  :

$str = "once upon a time
       once upon a time";
@store = $str =~ m/(once)/g;
print @store ;

This outputs "onceonce"
How come regex is searching beyond newline. I thought the search will
stop after first once.
When I replace /g with /m, the output I get is "once", but I thought /m will
tell regex at multiple lines for match.
Also when I replace /g with /s, I still get output "once"

Can someone demystify this for me ?
Is my assumption that regex will stop after encountering first newline is
applicable only when dot* type of regex is used ?

Thanks,
Sharan

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to