my $text = 'perl monks'; my $query = qr{ (?<M>monk) (?(<M>)(?{do_something_different()})) | (?<P>perl) (?(<P>)(?{do_something()})) }x; while($text =~ /$query/gi){}; sub do_something{ print "found perl\n"; } sub do_something_different{ print "found monk\n"; }
In reply to Re: While two conditions
by Anonymous Monk
in thread While two conditions
by welle
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |