Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^2: Exporting variables from perl script to shell

by Stevie-O (Friar)
on Dec 21, 2004 at 16:49 UTC ( #416532=note: print w/replies, xml ) Need Help??

in reply to Re: Exporting variables from perl script to shell
in thread Exporting variables from perl script to shell

I would code it like this:
do { local $ENV{FOO} = 'bar'; system($command); };
This gives you the temporary-env-value semantics of "FOO='bar' $command", yet doesn't assume that the user's shell has said semantics (Win32's cmd.exe certainly doesn't, for example).
$"=$,,$_=q>|\p4<6 8p<M/_|<('=> .q>.<4-KI<l|2$<6%s!<qn#F<>;$, .=pack'N*',"@{[unpack'C*',$_] }"for split/</;$_=$,,y[A-Z a-z] {}cd;print lc

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://416532]
[shmem]: well, previous to that << was always treated as the left-shift operator
[Eily]: or the here-doc operator
[Eily]: which is actually how it is parsed in this case
[shmem]: older versions of perl can't guess that "use of <<>> may be implemented someday" :D
Discipulus how much wise my brothers are? ;=)
[karlgoethebier]: thanks ;-
[karlgoethebier]: all for reading the manuals

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2017-07-21 09:09 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (320 votes). Check out past polls.