sub fubar { my $hashref = shift; print $hashref->{key1}, $hashref->{key2}; } ... fubar($arrayofhashes[$index]);