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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Use of uninitialized value..." reading %array tied to dbm file

Status
Not open for further replies.

msc0tt

IS-IT--Management
Jun 25, 2002
281
CA
I access a dbm file by tying it to an associative array (%database). One part of my code looks to see if a specific record exists:
$rec = $database{$key};
If there is no record by that $key, then $rec is assigned "" as expected. Unfortunately, this outputs an annoying error each time it occurs. (I use perl -w).
Any suggestions?
Mike.
 
You can always use this to avoid the annoying message.

if (defined($key)) {
$rec = $database{$key};
}


Hope this helps
 
You could also use the 'exists' command

ie. $rec = $database{$key} if(exists $database{$key});

Hope this helps ;)


char *p="char *p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top