in reply to Uninitialized value
> Returns an unitialized value warning, as expected.> my $junk; > print 1+$junk;
> Returns 1, no warning.> print 1+($junk ? $junk : 0);
This should not return a warning. This statement says, if $junk is true then return $junk add 1 to it and print the result. If $junk is false, which is the case since it is undefined, then return 0 and add 1 to it and print the result.
I think what you meant is if you wrote it like:
Then it will return a warning if $junk is undefined.print 1+ ( $junk ? 0 : $junk);
zzspectrez
|
|---|