Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

(bbfu) (hash slice) Re: Sorting hash values according to order of an array

by bbfu (Curate)
on Nov 24, 2002 at 03:36 UTC ( [id://215475]=note: print w/replies, xml ) Need Help??


in reply to Sorting hash values according to order of an array

As an alternative to tadman's solution, you could also use a hash slice, like so:

# Everything else is the same as your original code $sth->execute(@{$q{'-values'}}{@{$TABLES{$q{'-table'}}}}); # Or, a little more readably using temp vars: my $table = $q{'-table'}; my @columns = @{$TABLES{$table}}; my %values = %{$q{'-values'}}; $sth->execute(@values{@columns});

bbfu
Black flowers blossum
Fearless on my breath

  • Comment on (bbfu) (hash slice) Re: Sorting hash values according to order of an array
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-18 01:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found