[ic] Little puzzle for Perl gurus

Kevin Walsh interchange-users@icdevgroup.org
Tue Sep 17 13:11:01 2002


> > 
> > Sorry, this is more of a Perl issue than Interchange, 
> > but I'm stumped here. 
> > 
> > The following gives me the result I expected:
> > 
> > ##########################################
> > sub do_order_action { 
> >         my $page="";
> > 
> >         my ($ordernumber,$orderline,%subref,%CGI)=@_;
> >
> That's risky, better to pass in refs, eg \%subref, \%CGI.
>
The CGI is being used as if it was a hashref anyway, later in
the sub, so it may as well be passed in as one.

> >
> >         my $comment=$CGI->{"comment_$orderline"};
> >
Why pass the CGI hash(ref) in at all?  It's more than likely to be
available as a global.

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/