Raj wrote: > > Hello All, Hello,
> I have read modifier /o is used to compile the regexp only > once. But I don't know how it affects regular expression practically. > > Can anyone explain about /o modifier with examples? The /o modifier is used when you have a variable in a regular expression. $ perl -e' $_ = q[abcdefa]; print "without /o:"; $regexp = q[a]; while ( /($regexp)/g ) { print " $1"; $regexp++ } print "\nwith /o:"; $regexp = q[a]; while ( /($regexp)/og ) { print " $1"; $regexp++ } print "\n"; ' without /o: a b c d e f with /o: a a With the /o modifier, even though the variable is modified in the loop, the regular expression retains the original compiled value. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>