Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Is there any way to put regex modifiers into a variable?

by Discipulus (Canon)
on Mar 11, 2018 at 19:45 UTC ( [id://1210680]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    perl -e "$opts = 'io'; $rex = eval qq(qr/aka/$opts); print 'match' if 
    +'ALAKAIA' =~ $rex"
    
    match
    
  2. or download this
    my $opts = $ARGV[0];
    
    die "never trust user input" unless $opts=~/^[msixpodualn]+$/;
    
    ...
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-20 01:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found