If you know that you specifically want to use uninitialised variables, turn that warning off. It’s meant to help, not hinder you.
no warnings qw(uninitialized);
In this case, your two code snippets produce different results (the hyphen-minus is omitted in the second) so I wouldn’t suggest this technique. Be aware it’s there if you need it though.
Example
Before 5.6 this was only possible using $^W which turned off all warnings. Be very careful if you do that.
use warnings;
# This will generate a warning.
print undef;
{
no warnings qw(uninitialized);
# This won't.
print undef;
}
See Also