Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Yet another Uninitialized value

by clintp (Curate)
on May 04, 2002 at 21:41 UTC ( #164068=note: print w/ replies, xml ) Need Help??


in reply to Yet another Uninitialized value

Perhaps the error isn't where you think it is. Look:

while (my @row = $common::sql::sth->fetchrow()){ my $daily_time = sprintf("%d:%02d",$row[4],$row[5]); my ($total_minutes, $total_hours, $all_minutes, $total_time_hours, $to +tal_time_minutes); $total_minutes = $row[5]; $total_hours = $row[4] * 60; $all_minutes = $total_hours + $total_minutes; $total_time = $total_time + $all_minutes;
I don't see $total_time declared, and I don't see it initialized before it's used here.


Comment on Re: Yet another Uninitialized value
Download Code
Re: Re: Yet another Uninitialized value
by nlafferty (Scribe) on May 04, 2002 at 22:40 UTC
    Yes. yes. I found out what it is just before I looked at your post.
    I set
    $total_time = 0; before I used it in the while statement.

    The error occurred because the very first loop has no value for
    $total_time until $total_time = $total_time + $all_minutes;

    I discovered this by putting a print statment before and after $total_time = $total_time + $all_minutes;. The first print statement only had one value and all of the others had two. Thanks

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://164068]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2014-08-30 10:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (292 votes), past polls