Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: unconventional string substitutions

by hipowls (Curate)
on Mar 20, 2008 at 07:08 UTC ( [id://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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2024-04-20 06:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found