ravendarke has asked for the wisdom of the Perl Monks concerning the following question:
Returns an unitialized value warning, as expected.my $junk; print 1+$junk;
Returns 1, no warning.print 1+($junk ? $junk : 0);
Returns 12, seems to do what I want, but...$junk = 11; print 1+($junk ? $junk : 0);
returns 16, even though the value was defined as 0.$junk=0; print 1+($junk ? $junk : 15);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Uninitialized value
by ariels (Curate) on May 10, 2002 at 16:32 UTC | |
Re: Uninitialized value
by boo_radley (Parson) on May 10, 2002 at 16:39 UTC | |
Re: Uninitialized value
by chromatic (Archbishop) on May 10, 2002 at 16:32 UTC | |
Re: Uninitialized value
by zzspectrez (Hermit) on May 10, 2002 at 16:41 UTC | |
Re: Uninitialized value
by mephit (Scribe) on May 10, 2002 at 17:09 UTC | |
A reply falls below the community's threshold of quality. You may see it by logging in. |