jacques has asked for the wisdom of the Perl Monks concerning the following question:
blah1, blah2, and blah3 are column names in the $sth select. The values of those columns are key1, key2, and key3 respectively. Is there a way that I can directly reference the values of those column names (after the selectall_hashref) and ditch the foreach loops?my $asdf = $dbh->selectall_hashref($sth, ['blah1','blah2','blah3']); my ($key1, $key2, $key3); foreach $key1 (keys %{$asdf}) { foreach $key2 (keys %{$asdf->{$key1}}) { foreach $key3 (keys %{$asdf->{$key1}->{$key2}} +) { # Do something here... } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBI's selectall_hashref and nested foreach loops
by gube (Parson) on Jul 06, 2005 at 00:57 UTC | |
|
Re: DBI's selectall_hashref and nested foreach loops
by runrig (Abbot) on Jul 06, 2005 at 03:54 UTC | |
|
Re: DBI's selectall_hashref and nested foreach loops
by anonymized user 468275 (Curate) on Jul 06, 2005 at 11:14 UTC |