[vox-tech] perl question: ENV
Peter Jay Salzman
vox-tech@lists.lugod.org
Wed, 3 Apr 2002 09:47:37 -0800
begin Jeff Newmiller <jdnewmil@dcn.davis.ca.us>
> 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.
ahhh... ok, that explains why it didn't work.
> 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.
much more elegant. thanks!
pete