Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: arguments to perl -e

by explorer (Chaplain)
on Apr 07, 2006 at 17:02 UTC ( #541922=note: print w/replies, xml ) Need Help??


in reply to arguments to perl -e

#!/bin/bash file=$1 var=$2 cat $file | perl -e 'BEGIN { $var = $ARGV[0] } print <STDIN>' $var > o +utput

Replies are listed 'Best First'.
Re^2: arguments to perl -e
by explorer (Chaplain) on Apr 08, 2006 at 09:14 UTC
    Other solution. Insert $var variable before the file and send the stream. The Perl script will read it at BEGIN step:
    #!/bin/bash file="timer" var="Two" (echo $var; cat $file) | perl -e 'BEGIN { $var=<> } print <>; END { p +rint $var }' > output

    Ok... Is UGLY, I know it... but I have impatience!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://541922]
help
Chatterbox?
[Your Mother]: American English vowels are pretty lazy/mumbly in general.
[LanX]: talking about antisemitism, youtube automatic subtitles is entertaining shocking sometimes ... like when offering "Fruit Jews" as a drink
[Your Mother]: ...Come on you King of the Juice...
[Your Mother]: I actually know his kids.
LanX has to go/
[Your Mother]: King Herod's song (Mike D'Abo performed, I think)
[Eily]: I'm leaving too, bye!

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (11)
As of 2017-03-27 17:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.