my %gnarf = mysub($val); my $foo = $gnarf{'foo_count'}; my $bar = $gnarf{'bar_count'}; my @gak = @{$gnarf{gak_array}}; my @flub = @{$gnarf{flub_array}}; ### Take in the string $val, produce some ### scalars and two arrays sub mysub { my $val = shift; # do stuff with $val, a string, producing @foos, # @bars, @gaks, and @flubs, and some other simple # scalars here to count the elements in the list my $foos = @foos; # count elements of @foos my $bars = @bars; # ditto for @bars return (foo_count => $foos, bar_count => $bars, gak_array => [sort @gaks], flub_array => [sort @flubs]); }