"Use of initialized value in scalar assignment"
am 02.01.2008 21:14:35 von kj
The following innocent-looking one-liner:
% perl -we '$ENV{ FOO } = undef'
produces the warning:
Use of uninitialized value in scalar assignment at -e line 1
Is this a bug, or is there a good reason for this?
FWIW, I've seen this behavior only with %ENV. I got the above
using v5.8.8 on Linux.
TIA!
kj
--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
Re: "Use of initialized value in scalar assignment"
am 02.01.2008 21:27:41 von someone
kj wrote:
>
> The following innocent-looking one-liner:
>
> % perl -we '$ENV{ FOO } = undef'
>
> produces the warning:
>
> Use of uninitialized value in scalar assignment at -e line 1
>
> Is this a bug, or is there a good reason for this?
>
> FWIW, I've seen this behavior only with %ENV. I got the above
> using v5.8.8 on Linux.
What makes you think that you could set an environment variable to the
undef value? How does that make sense?
man 3 setenv
Perhaps you meant to use delete() instead:
delete $ENV{ FOO }
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
Re: "Use of initialized value in scalar assignment"
am 02.01.2008 21:28:15 von John Bokma
kj wrote:
> The following innocent-looking one-liner:
>
> % perl -we '$ENV{ FOO } = undef'
>
> produces the warning:
>
> Use of uninitialized value in scalar assignment at -e line 1
>
> Is this a bug, or is there a good reason for this?
>
> FWIW, I've seen this behavior only with %ENV. I got the above
> using v5.8.8 on Linux.
What do you expect from setting an environment variable to undef?
--
John
Arachnids near Coyolillo - part 1
http://johnbokma.com/mexit/2006/05/04/arachnids-coyolillo-1. html