http://qs321.pair.com?node_id=172080


in reply to map, grep, for, foreach

my @param = $q->param(); @input{@param} = map $q->param($_), @param;
I couldn't be bothered to Benchmark it but I suspect this is going to be the most efficient or at least a very competitive variant, especially so if the number of parameters is substantial.

Update: Or maybe this:
my @param = $q->param(); @input{@param}=(); $input{$_} = $q->param($_) for @param;
Finally, this leads us to another variation which I like best:
@input{$q->param()}=(); $input{$_} = $q->param($_) for keys %input;
Between the latter two, I'm not sure which one will perform better.

Makeshifts last the longest.