Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 ( #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? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2022-10-02 16:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (11 votes). Check out past polls.

    Notices?