Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: map, grep, for, foreach

by Aristotle (Chancellor)
on Jun 06, 2002 at 05:09 UTC ( [id://172080]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://172080]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-25 17:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found