Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Initializing this array 1

Status
Not open for further replies.
Dec 17, 2002
41
US
This question is really basic but I'm having a Monday. Besides, this is why my handle is Perltard.

In the following code sample I keep getting an error reading, "Use of uninitialized value in join or string at G:\orant\REPORT60\DPRIS Web Page\CGI-BIN\table_backup.pl line 39." Now, I've tried to initialize the array the different ways I know how without screwing up the ending value of the array, but I'm not having any luck.

while ( my (@String) = $sth->fetchrow_array) {

#Print out the result
my $data="$table_Name.txt";
my @ltime = localtime;
$ltime[5]+=1900;
$ltime[4]=sprintf("%02d", $ltime[4]+1);
$ltime[3]=sprintf("%02d", $ltime[3]);
my $foldername = $ltime[4]."-".$ltime[3]."-".$ltime[5];
mkdir ("G:/orant/REPORT60/DPRIS Backup Data Files/$foldername");
open(DAT,">>../DPRIS Backup Data Files/$foldername/$data") || die("Cannot Open File");
print DAT "'";
print DAT join "', '", @String;
print DAT "'";
print DAT "\n";
close(DAT);

}

Could somebody please show me my ignorance! Thanks.
 
You probabaly have a NULL value in one of your fields of the database. You will either have to explicitly check for undefined values or locally turn of warnings
Code:
    print DAT "'";
{
    no warnings; # localized to the enclosing block
    print DAT join "', '", @String;
}
    print DAT "'";
jaa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top