http://qs321.pair.com?node_id=61237

Fingo has asked for the wisdom of the Perl Monks concerning the following question:

This is a subroutine from a program of mine and it's call. Why does -w give me an uninitialized value error, I defined it correctly. The program works right if I turn off -w.
#!/usr/bin/perl print CalcBalance(\"balance.log"); sub CalcBalance { my ($balance, @log); my $location = 0; #because my $location = shift(@ARGV) does not w +ok either. $location = shift(@ARGV); # the following is not needed # open (RBALANCE, $location); # @log = <RBALANCE>; # $balance = $log[-1]; # close (RBALANCE); # if (@ARGV && $ARGV[0] != 0) { # we check to see if there is a +nother # # argument (the amount to change) a +nd # # it is not 0. # # my $toChange = shift (@ARGV); # we only declare this if another # # argument exists to make the test # # above work. # $balance += $toChange; # open (WBALANCE, ">>$location"); # print WBALANCE $balance; # close (WBALANCE); # } }


Thanks