Turn off warnings selectively and in a small scope
- no warnings
#!/usr/bin/perl
use strict;
use warnings;
my $total;
add();
print "$total\n";
sub add {
no warnings 'uninitialized';
$total = $total + rand();
}
See
perldoc warnings for the use of warnings
perldoc perllexwarn for the warning categories
perldoc perldiag for a list of warnings and errors