[ic] perl syntax of shopping cart items

Kevin Walsh interchange-users@interchange.redhat.com
Fri Apr 12 07:40:01 2002


> > So, stripping down the above example, you can push all the SKU
> > values into one array using the following two lines of Perl code:
> > 
> >     my @out;
> >     push(@out,$_->{code}) for (@{$Carts->{main}});
> >
> A little bit more appropriate is:
> 
> @out = map {$_->{code}) @{$Carts->{main}};
> 
I didn't think of that. :-)

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