Unitialized value in hash element problem...



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
.



Relevant Pages

  • Unitialized value in hash element problem...
    ... I'm getting the following error when executing the function listed below... ... 224 # Build a hash of pricelist names/ids from an inc file ... 227 sub build_pricelist_hash { ...
    (perl.beginners)
  • Re: looking for help with a counting algorithm
    ... >> subcategory is counted, the code goes back up the tree to the root, adding ... >> involve retrieving all the category memberships from the database, ... sub ReadCategories{ ... ReadCategories is called with two empty hash pointers by any of the ...
    (comp.lang.perl.misc)
  • Re: Packages and returning errors
    ... >>of instance data. ... >>sub rtnError { ... its a reference to a hash. ... functions in the package to see it. ...
    (comp.lang.perl.misc)
  • Re: Paste not working in With statement - do I have too many With
    ... I broke it down into a small sub of it's own, manually executed it, and it ... still did not work (FYI - I verified the sheet is not protected). ... It worked fine for me (after I commented the CheckRange stuff). ... below is not executing properly in my code. ...
    (microsoft.public.excel.programming)
  • Re: Paste not working in With statement - do I have too many With
    ... Did you try it against a couple of different worksheets? ... I broke it down into a small sub of it's own, manually executed it, and it ... "Dave Peterson" wrote: ... below is not executing properly in my code. ...
    (microsoft.public.excel.programming)