[vox-tech] perl question: ENV

Jeff Newmiller vox-tech@lists.lugod.org
Wed, 3 Apr 2002 09:40:25 -0800 (PST)


On Wed, 3 Apr 2002, Peter Jay Salzman wrote:

> i need access to the shell variable $$.   tried this:
> 
> 	my $file = $ENV{$};
> 
> which didn't work.  i managed to do it with:
> 
> 	my $file = `echo $$`;
> 
> but i'm curious -- is there a way to access $$ with the ENV hash?

I don't think so.  Special shell variables are implemented in the
commandline interpretation, not in ENV.

If you were going to access the $th element of the ENV hash, I think you
would use $ENV{'$'}.

The getppid() function should obtain the parent process id for you.

---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...2k
---------------------------------------------------------------------------