krisahoch has asked for the wisdom of the Perl Monks concerning the following question:
I showed him to do something like this. (Disclaimer. Normally I'd tell him to use strict, but I didn't.# The person was trying to return a result set # was doing this. $sth->execute; #his statement handle was $responce %hash = \%($responce); return %hash;
The next question was why $hash instead of %hash... Someone else answered, but it got me to thinking. What IS the difference between a named hash and an unnamed hash? (besides syntax)$sth->execute; my $hash = {}; while(my $row = $sth->fetchrow_hashref()){ $hash->{$row->{'id'}} = $row; } return ($hash);
Kristofer Hoch
Si vos can lego is, vos es super erudio
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: What's the difference between named and unnamed hashes?
by broquaint (Abbot) on Jun 06, 2003 at 14:01 UTC | |
by krisahoch (Deacon) on Jun 06, 2003 at 14:17 UTC | |
|
Re: What's the difference between named and unnamed hashes?
by derby (Abbot) on Jun 06, 2003 at 14:01 UTC |