in reply to Re: Use of uninitialized value
in thread Use of uninitialized value
foreach (@SQL_queries) { my $Results = $_; my $sth_atl = $dbh->prepare($Results) or die "Couldn't prepare que +ry: ".$dbh->errstr; $sth_atl->execute() or die "Couldn't execute query: ".$sth_atl->er +rstr; my $cols_for_row; while ($cols_for_row = $sth_atl->fetchrow_arrayref) { print OUTFILE "England\t"; print OUTFILE join("\t",@$cols_for_row),"\n"; my $last_element = @$cols_for_row[-1]; my $indicator = @$cols_for_row[-2]; my $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 sec +ond to last element of the array\n"; } print "\n>>>>>numerator>>>>>>>>>>>> $numerator\n"; # Works here print "\n>>>>>>denominator>>>>>>>>>>> $denominator\n"; # Works her +e if (($numerator > 0) && ($denominator > 0)){ print "\n>>>>>numerator>>>>>>>>>>>> $numerator\n"; # Does not wo +rk here print "\n>>>>>>denominator>>>>>>>>>>> $denominator\n"; # Does not +work here my $expected_ratio_figure = ($numerator)/($denominator); print OUTFILE "\n\nThe expected ratio figure:\t"; print OUTFILE "$expected_ratio_figure\n\n"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Use of uninitialized value
by Ratazong (Monsignor) on Nov 23, 2010 at 11:31 UTC | |
by Anonymous Monk on Nov 23, 2010 at 11:39 UTC | |
by marto (Cardinal) on Nov 23, 2010 at 11:49 UTC | |
by Anonymous Monk on Nov 23, 2010 at 11:59 UTC | |
by Boldra (Curate) on Nov 23, 2010 at 14:58 UTC | |
by Ratazong (Monsignor) on Nov 23, 2010 at 13:22 UTC | |
|
Re^3: Use of uninitialized value
by chromatic (Archbishop) on Nov 23, 2010 at 19:19 UTC | |
|
Re^3: Use of uninitialized value
by cjb (Friar) on Nov 23, 2010 at 11:41 UTC | |
by Anonymous Monk on Nov 23, 2010 at 11:59 UTC | |
by cjb (Friar) on Nov 23, 2010 at 12:20 UTC | |
|
Re^3: Use of uninitialized value
by Anonymous Monk on Nov 23, 2010 at 11:36 UTC |