Hi all,

I've got a problem understanding a scoping issue I've got.

I've got 2 hashes which I defined inside the sub that generates the form thus:

sub do_form() {
  my ($error)=@_;
  my %dships=('X'=>'<Any>','L'=>'Leeds','D'=>'Doncaster');
  my %depts=('X'=>'<Any>','S'=>'Service','P'=>'Parts','T'=>'Rapid-Fit',
             'B'=>'Bodyshop','C'=>'Commercial','N'=>'New Cars',
             'U'=>'Used Cars');
.....
   print $query->popup_menu('dealer',['X','L','D'],'X',\%dships);
  print qq{</td></tr><tr><td>Department</td><td>};
  print $query->popup_menu('dept',['X','P','S','B','T','C','N','U'],'X',
         \%depts);
.....
}

This worked fine until I needed the same 2 hashes in other sub's so I moved 
them to the top of the script - outside any sub{} blocks.  I thought that 
this would then make those hashed available to everyone.  

What actually happened was that the hashed became unavailable and on the form 
I simply saw the single letters as defined in the array.
-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to