Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Using a regex saved in an environment variable

by J0ax88 (Initiate)
on May 03, 2012 at 02:03 UTC ( [id://968605]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    perl -00 -ne 'print if /--Begin--/ && /--End--/' file.txt
    
  2. or download this
    Hello World
    
    ...
    other stuff 
    This is a test
    Good Bye
    
  3. or download this
    --Begin--
    Cat
    and
    Dog
    --End--
    
  4. or download this
    export REX="/--Begin--/ && /--End--/"
    echo $REX
    /--Begin--/ && /--End--/
    
  5. or download this
    perl -00 -ne 'BEGIN {$rex = $ENV{REX}} print if qr($rex)' file.txt
    
  6. or download this
    perl -00 -ne 'BEGIN {$rex = qr($ENV{REX})} print if $rex' file.txt
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-20 03:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found