Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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 drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2025-05-22 13:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.