Hello Dave,

#!/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.

No the error means its not initialized :)

Try seeing what %ENV is:

#!/usr/bin/perl

use strict;
use warnings;
use Data::Dumper;

pritn Dumper \%ENV;

To see what %ENV looks like to perl.

or even quicker:

 perl -mstrict -MData::Dumper -we 'print Dumper \%ENV;'

You can avoid the error by initializing it:

$ perl -mstrict -we 'print $ENV{SIP_HF_FROM};'
Use of uninitialized value in print at -e line 1.
$ perl -mstrict -we '$ENV{SIP_HF_FROM} = "" if !defined $ENV{SIP_HF_FROM};print $ENV{SIP_HF_FROM};'
$


Thanks in advance,

No problem :)

--
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