in reply to building an HoAoH ... very badly

This has nothing to do with your question, but while we are at it...

You are fetching the whole result set into a memory structure. In this case, you could use DBI's fetchall_arrayref or even selectall_arrayref methods. The latter combines prepare, bind, and fetch into one call:

my $data = $conn->selectall_arrayref(q{ select season, episode, name from episodes where show = ? }, {Slice => {}}, 'Simpsons' );
The {Slice => {}} gives you a hashref for every row (default is arrayref).