in reply to Building an array of hashes from database

As noted above, the hash ref isn't quite right in your code. Try this:
while (my @row = $sth->fetchrow_array()) { push @records, {name => $row[0], ip => $row[1], email => $row[2]}; }
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 :)