You only ever initialise $numerator or $denominatormy $numerator; my $denominator; if ($indicator eq "SH"){ $numerator = $last_element; } elsif ($indicator eq "SL"){ $denominator = $last_element; } else { print "\nError: There has been an unexpected string within + the second to last element of the array\n"; }
might work, if 0 is a suitable default value for you.my $numerator = 0; my $denominator = 0;
In reply to Re^3: Use of uninitialized value
by cjb
in thread Use of uninitialized value
by Win
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |