my %hash = ( 'This' => 1, 'That' => 2, 'Other' => 3 ); my @array = ( 1, 2, 3, 4, 5 ); my $scalr = "Hello World!\n"; mytest ( \%hash, \@array, $scalr ); sub mytest { my $h_ref = shift; my $a_ref = shift; my $simple = shift; local $, = ", "; print $h_ref->{$_}, "\n" foreach keys %{$h_ref}; print $_, "\n" foreach @{$a_ref}; print $simple, "\n"; }