On Tue, 5 Oct 2004 14:32:27 -0400, Willy Perez <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Is there a method to pass a shell assigned variable to perl?
>
> For ex:
>
> ABC=xyc
>
> perl -ne 'print $ABC'
>
> In awk you could use ENVIRON["varname"], is there something
> compatible in perl.
>
>
> Willy Perez
> Liz Claiborne IT
> (201) 295-7011
>
Hi Willy,
Perl will auto-magically take all of your shell environment variables
and put them in a hash:
%ENV
where the keys are the variable names and the values are the values!
so, for your example above,
# perl -e 'print "$ENV{ABC}\n"'
should work!
--Errin
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>