I keep getting the following errors everytime I call my get_prevday subroutine which is at the bottom. I have initialized all the variables in the program that I can think of. Please help!!:

"Use of uninitialized value in array element at
Thickness_vs5.cgi line 542. <FILE> line 71. "


"Use of uninitialized value in array element at
Thickness_vs5.cgi line 543. <FILE> line 71. "







.
.
my @date, $m, $md, $y, $epochtime;
$date[$x]= get_prevday($date[$x]);
.
.
.
###################Subroutines ###################
LINE 542 ->sub get_prevday { $date[$x] = shift || return(0);
LINE 543 ->($m,$md,$y) = $date[$x] =~ m|(\d+)/(\d+)/(\d+)|;
$epochtime = timelocal_nocheck(0, 0, 0, $md-1, $m-1, $y);
return strftime("%m/%d/20%y",0,0,0,(localtime($epochtime))[3,4,5]);}

Recommended Answers

All 2 Replies

I keep getting the following errors everytime I call my "get_prevday" subroutine which is at the bottom. I have initialized all the variables in the program that I can think of. Please help!!:

"Use of uninitialized value in array element at
Thickness_vs5.cgi line 542. <FILE> line 71. "

"Use of uninitialized value in array element at
Thickness_vs5.cgi line 543. <FILE> line 71. "


.
.
my @date, $m, $md, $y, $epochtime;
$date[$x]= get_prevday($date[$x]);
.
.
.
###################Subroutines ###################
LINE 542 ->sub get_prevday { $date[$x] = shift || return(0);
LINE 543 ->($m,$md,$y) = $date[$x] =~ m|(\d+)/(\d+)/(\d+)|;
    $epochtime = timelocal_nocheck(0, 0, 0, $md-1, $m-1, $y);
                    return strftime("%m/%d/20%y",0,0,0,(localtime($epochtime))[3,4,5]);}

end quote.

It looks to me like the culprit might be line 71 in whatever file / data you are reading. Have you checked that source for maybe a missing data field?

You don't want to do this:

$md-1

I explained why in your other thread.


Where is $x getting defined?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.