sub process_something { my $s1 = shift; my $s2 = shift; my $arrayref1 = shift; my $arrayref2 = shift; # And instead of creating new hashes from the # references passed in... #my @array1 = @$arrayref1; #my @array2 = @$arrayref2; # You can use the references themselves... # like $arrayref->[i] below... print "Subroutine process_something: \$s1 = $s1\n"; print " \$s2 = $s2\n"; my $count_array1_elements = @$arrayref1; for ($i = 0; $i < $count_array1_elements; $i++) { printf "Array1 Element %d = %s\n", $i, $arrayref->[i]; } } process_something($scalar1, $scalar2, \@array1, # pass a *reference* to the array \@array2); # same