in reply to your Perl bug Achilles heel
use strict; use warnings; my @products = ( {id => 'jam', quantity => 10}, {id => 'cream', quantity => 4}, ); mySub (user => 'Flibble', map {$_->{id} => $_->{quantity}} @products +); print "\n"; mySub (user => 'Flibble', (map {$_->{id} => $_->{quantity}} @products) +); sub mySub { my %params = @_; print "$_: $params{$_}\n" for keys %params; }
Prints:
cream: 4 user: Flibble jam: 10 cream: 4 user: Flibble jam: 10
and the difference is?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: your Perl bug Achilles heel
by perrin (Chancellor) on Dec 05, 2008 at 02:39 UTC |