my $data_ref = shift; #Big array foreach my $record (@{$data_ref}) { -- do things more efficiently -- }