in reply to Re^2: Use of uninitialized value
in thread Use of uninitialized value
my $numerator; my $denominator;
Here both $numerator and $denominator contain undef.
if ($indicator eq "SH"){ $numerator = $last_element; }
If that branch is true, $numerator will contain the value of $last_element, which may be undef. $denominator will still contain undef.
elsif ($indicator eq "SL"){ $denominator = $last_element; }
If that branch is true (and it will only be true if the first branch is false, in which case $numerator will still contain undef), $denominator will contain the value of $last_element, which may be undef.
else { print "\nError: There has been an unexpected string within the sec +ond to last element of the array\n"; }
If this branch is true, both $numerator and $denominator contain undef.
At this point, at least one of those two variables does contain undef. Both may.
|
|---|