Schaelle has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks, I am working on a script that gets by DBI an hash ref inside an array ref. To get the field names of the SQL result I have to dereference the hash ref inside the array ref, so I can go thru any field name using foreach. No problem so long, I using the following code for doing that:
foreach my $head (@{$sth->{NAME_uc}}) { print $head . "\n"; }
But as I remember from the Alpaca book I mixed up two syntax styles. Each for the array ref and the hash ref. So my question now: How look the pretty code for the dereferencing in the above code?
Thanks, so long!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dereferencing a hash ref in an array ref
by moritz (Cardinal) on Mar 26, 2010 at 08:05 UTC | |
by Schaelle (Novice) on Mar 26, 2010 at 08:32 UTC | |
|
Re: Dereferencing a hash ref in an array ref
by Anonymous Monk on Mar 26, 2010 at 07:34 UTC | |
by Schaelle (Novice) on Mar 26, 2010 at 07:54 UTC | |
by Anonymous Monk on Mar 26, 2010 at 08:38 UTC |