in reply to Building an array of hashes from database
You can drop the my %data; statement using this approach, too. This makes it clear (to my eye, of course) that a new (anonymous) hash ref is used each time around. Check out perlref for more stuff on anonymous data structures and references. Good stuff :)while (my @row = $sth->fetchrow_array()) { push @records, {name => $row[0], ip => $row[1], email => $row[2]}; }
|
|---|