in reply to Re^4: When DOESN'T "Use of uninitialized value" show up?
in thread When DOESN'T "Use of uninitialized value" show up?

Nevertheless, I don't often use uninitialized values as actual values

You never optional fields in your data structures? You never use optional parameters? You never use output parameters (e.g. open)?

I use undefined values every 5 lines of code, I bet. Yes, you're telling me that one in five of my lines of code should warn.

And I don't consider "my $x = 123;" to use undef at all: in this context

That may be, but it is. You're doing sassign($x, 123) and $x is undefined, and you indicated you want all undefined operands to warn.

since it's defined to deal with undef, certainly it should not throw a warning with undef!

And of course, so are truth tests.

Thank god. I thought you wanted us to use

if (exists($h{x} && defined($h{x}) && $h{x})

instead of

if ($h{x})

I would like warnings whenever I try to access the value of undef.

Except you said you don't want those that expect undef as an argument to warn, so I don't know of a single thing you think should start warning that doesn't already.

Update: I just thought one. You surely want length($undef) to warn. That used to be the case, but that got fixed.

This way, the common check

if (defined($s) && length($s))

can be written as

if (length($s))

And it doesn't hurt since you still get a warning (instead of two) if you use length wrong.

my $length = length($undef); # Used to warn here. print $length; # Still warn here. my $length = length($undef); # Used to warn here. for (1..$length) # Still warn here. my $length = length($undef); # Used to warn here. pack 'N', $length # Still warn here. ...

As far as I can tell, the only change you want to have done is to remove a small but awesome improvement to Perl.