http://www.perlmonks.org?node_id=1040177

walkingthecow has asked for the wisdom of the Perl Monks concerning the following question:

For example:
$rows = $dbh->selectall_arrayref( " SELECT name,age,gender FROM people ", { Slice => {} } ); foreach my $row (@$rows) { my $name = $row->{name}; my $age = $row->{age}; my $gender = $row->{gender}; }
All the documentation I am reading on arrayrefs is accessing the results like so:
$ { $array_ref } [2]
I have yet to find a single one that accesses the value with a key, like DBI does (e.g., $row->{column}). So, this leaves me wondering exactly how the DBI module returns an arrayref whose values can be accessed with keys (the column names). If anyone could help me understand this, or point me in the right direction, it would be greatly appreciated.