On Sun, Feb 22, 2004 at 12:30:14AM +0000, RichT ([EMAIL PROTECTED]) wrote:
<snip>
> My next question is, how can i read in variables from the shell?
>
> im using Solaris / ksh
You can access environment variables though the %ENV hash. I've listed a
couple standard ways to do so below. If you are creating the variable just
export it and it will be picked up by %ENV. At least it works that way
for bash.
------------------------------------
#!/usr/bin/perl
use warnings;
use strict;
# print logname
my $log_name = ($ENV{'LOGNAME'});
print "$log_name\n";
# print all ENV variables
foreach (sort keys %ENV) {
print "$_ = $ENV{$_}\n";
}
-----------------------------------
hth,
Kent
--
"Efficiency is intelligent laziness."
-David Dunham
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>