Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

wants to export global variable

by anandpu70 (Initiate)
on Apr 04, 2013 at 07:40 UTC ( #1026943=perlquestion: print w/ replies, xml ) Need Help??
anandpu70 has asked for the wisdom of the Perl Monks concerning the following question:

I want to export global variable in the perl script like https_proxy=https://url:8080; export $https_proxy. How do i do this in perl script.

Comment on wants to export global variable
Re: wants to export global variable
by aitap (Deacon) on Apr 04, 2013 at 07:47 UTC
Re: wants to export global variable
by Loops (Hermit) on Apr 04, 2013 at 08:18 UTC

    You can't change the environment of the calling process directly. You would have to arrange for that process to call your perl program and stuff whatever it prints into the environment variable of your choice

    You can change the environment variables of any child process you call:

    $ENV{'hello'}='goodbye'; system('echo greetings from the shell, $hello');

    Much of this has been discussed in other threads. Here is one, Set shell environment variables from within a perl script

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1026943]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (14)
As of 2014-07-10 13:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (211 votes), past polls