sub set { my ($arg_ref) = @_; my @array = @{$arg_ref->{'foo'}}; my %hash = %{$arg_ref->{'bar'}}; my $string = ${$arg_ref->{'baz'}}; my @array1 = ["a" .. "z"]; my @array2 = ["A" .. "Z"]; return [\@array1, \@array2]; } # call my ($array1_ref, $array2_ref) = set({ foo => [0 .. 9], bar => { key => 'value', }, baz => \"test", });