-----Original Message-----
From: Dave Kettmann [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 02, 2004 11:14 AM
To: Perl List (E-mail)
Subject: Working with Environment Variables

Hi List,

I am trying to get an environment variable into another variable (for ease
of use) and I am having trouble. It seems to only be with 2 certain
variables as I can do the following:

#!/usr/bin/perl

use strict;
use warnings;

my $path1 = $ENV{'PATH'};

print $path1

__END__

And it will print the path as it should. But if I do this:

#!/usr/bin/perl

use strict;
use warnings;

my $from1 = $ENV{'SIP_HF_FROM'};

print $from1;

__END__

I get: Use of uninitialized value in print at test.pl line 8.

When I type "set" at the command line, I do see the variable SIP_HF_FROM ...
...
SHLVL=1
SIP_HF_FROM=sip:+16364424593
SIP_RURI=BLAH2
...

Is it that there is a bad character in the variable that I dont know about?
Any help is appreciated as always. I hope I explained myself well enough. 

Thanks in advance,

Dave Kettmann
NetLogic
636-561-0680

[jwm] 
On Unix you must "export" the variable to see it in the perl script...


<snip>
$ A='Externally set'
$ export A
$ perl -e 'print "ENV{$_} =<$ENV{$_}>\n" foreach (sort keys %ENV);'
ENV{A} =<Externally set>
...
</snip>

Hope this helps ...

jwm

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to