467,146 Members | 1,004 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,146 developers. It's quick & easy.

appending to PATH

So many web sites state that $ENV{‘PATH’} = “/newpath:$ENV{‘ PATH’}”; should append to path.

When I include that in perl code, and echo $PATH afterwards, or just type env, there is no change in $path. ???

Any ideas? Thanks.
M.
Sep 23 '08 #1
  • viewed: 2560
Share:
1 Reply
numberwhun
Expert Mod 2GB
In a Perl script, the %ENV variable is actually a hash. Each variable in the hash is a key which has a value. One of those keys is "PATH", which contains the system path contents. The %ENV hash contains the CGI Envornment variables.

To print it out, use this:

Expand|Select|Wrap|Line Numbers
  1. print "Content-type: text/html\n\n";
  2. print "<tt>\n";
  3. foreach $key (sort keys(%ENV)) {
  4.       print "$key = $ENV{$key}<p>";
  5. }
  6.  
To modify the hash, I would look up a tutorial on hashes if you don't already know how.

Regards,

Jeff
Sep 23 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by ketulp_baroda@yahoo.com | last post: by
reply views Thread by Greg McIntyre | last post: by
1 post views Thread by Jonathan Taylor | last post: by
4 posts views Thread by John A Grandy | last post: by
4 posts views Thread by Gordon | last post: by
4 posts views Thread by John [H2O] | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.