Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: unconventional string substitutions

by hipowls (Curate)
on Mar 20, 2008 at 07:08 UTC ( #675171=note: print w/ replies, xml ) Need Help??


in reply to unconventional string substitutions

Another approach is to use embedded flags, it is possible to embed all the modifiers except /g and /c

#!/net/perl/5.10.0/bin/perl use strict; use warnings; use 5.010_000; my $string = 'This is perl, the Perl interpreter'; foreach my $flag ( '', 'i' ) { if ( my ($match) = $string =~ /(?$flag:(Perl))/ ) { print "$match\n"; } } Perl perl __END__

Update: also doesn't work with /c, add it above.


Comment on Re: unconventional string substitutions
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://675171]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (14)
As of 2014-07-28 17:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (204 votes), past polls