[ic] perl syntax of shopping cart items

Stefan Hornburg Racke interchange-users@interchange.redhat.com
Fri Apr 12 04:13:01 2002


"Kevin Walsh" <kevin@cursor.biz> writes:


[...]

> 
> 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}};

Ciao
        Racke

-- 
Think of it !

For projects and other business stuff please refer to COBOLT NetServices
(URL: http://www.cobolt.net; Email: info@cobolt.net; Phone: 0041-1-3884400)