Avoid warnings
use strict;
use warnings;
my $total;
add();
print "$total\n";
sub add {
if (not defined $total) {
$total = 0;
}
$total = $total + rand();
}
A lot of work. Cannot be done easily to an existing application.
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
use strict;
use warnings;
my $total;
add();
print "$total\n";
sub add {
if (not defined $total) {
$total = 0;
}
$total = $total + rand();
}
A lot of work. Cannot be done easily to an existing application.