Unitialized value in hash element problem...
- From: webmaster@xxxxxxxxxxxxxxx (Tony Frasketi)
- Date: Tue, 16 Aug 2005 19:31:33 -0500
Hello Listers I'm getting the following error when executing the function listed below...
cimagedisp_new.cgi: Use of uninitialized value in hash element at /.../cimagedisp_new.cgi line 238, <FILE> line 69.
223 #-------------------------------------------------------------
224 # Build a hash of pricelist names/ids from an inc file
225 # my(%plhash) = &build_pricelist_hash($plnameid_file);
226 #-------------------------------------------------------------
227 sub build_pricelist_hash {
228 my($file) = @_;
229
230 my(%plhash) = ();
231 if(!open(FILE,$file)) {
232 &abort_program("<b>FILE ERROR:</b><br>Can't open file $file<br>\n[$!]");
233 }
234 my($i) = 0;
235 while (<FILE>) {
236 chop $_;
237 my($name,$id) = split(/\|/,$_);
238 $plhash{$id} = $_;
239 $i++;
240 }
241 close(FILE);
242 return %plhash;
243 }
The plnameid file contains lines formatted as follows...
-----------------------------------------------------------------
Classic Chimpanzee/Monkey Space Flight Covers|chimps
Experimental Test Covers, Various Flights, Various Cachets|exfl01
GEMINI Program Prime Recovery Ships|primesc2
etc....
-----------------------------------------------------------------
where the first item in each line is a pricelist description and the second item is the name of the pricelist.
I've tried initializing %plhash and $name and $id to no avail...
Please ignore $i as it was previously use for another purpose but I forgot to remove it.
Any help would be greatly appreciated... Tony frasketi .
- Prev by Date: RE: Find string ending with %
- Next by Date: Re: Find string ending with %
- Previous by thread: Re: Unitialized value in hash element problem...
- Next by thread: Find string ending with %
- Index(es):
Relevant Pages
|