use the %ENV hash

print $ENV{HOSTNAME};

for example

to see a full list of available enviroment settings do

foreach $key(sort keys %ENV) {
        print "ENV $key => $ENV{$key}\n";
}

HTH

John

-----Original Message-----
From: Mark Johnson [mailto:[EMAIL PROTECTED]]
Sent: 08 November 2001 15:02
To: PERL Beginners (E-mail)
Subject: is there another way to do this?


Is there another way to get access to the environment variables... this
works, but it seems kind of kludgy..

my $machine = `echo \$HOSTNAME`;

Also, is there a way to detemine whether the script is being executed by
root?

I tired doing:

my $is_root = `echo \$UID`

but for some reason this doesn't work, but it works in a bash script...it
appears that $UID isn't available or something...

thanks!




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------Confidentiality--------------------------.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to