You have to export the variable if you want perl to recognize it! Example:
$ ABC=xyz $ perl -e 'print "$ENV{ABC}\n"' $ export ABC=xyz $ perl -e 'print "$ENV{ABC}\n"' xyz $ -Jeff On Tue, 05 Oct 2004 15:30:59 -0700, John W. Krahn <[EMAIL PROTECTED]> wrote: > Jim wrote: > > > > Willy Perez wrote: > >> > >>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. > > > > You can do the same in perl with the special hash named %ENV. > > for instance: print $ENV{'SHELL'} > > > > or you can use the env module: > > perldoc -f env > > perl is case sensitive so that should be Env not env. > > John > -- > use Perl; > program > fulfillment > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>