### Take in the string $val, produce some ### scalars and two arrays sub mysub { my $val = shift; my @foos = 0 .. rand(50); my @bars = 0 .. rand(50); return scalar @foos, # How many foos scalar @bars, # How many bars [sort @foos], # Assorted foos (no chilli) [sort @bars]; # Ditto bars (hic!) } my $val = 'Irrelevant'; my ($foo, $bar, $gak, $flub) = mysub($val); print "I have $foo foos: @{$gak}\n"; print "I have $bar bars: @{$flub}\n"; # That's "sheep" and "pub" when I'm sober. print "The first foo is $gak->[0]\n"; print "The last bar is $flub->[-1]\n"; __DATA__ D:\Perl\test>junk I have 24 foos: 0 1 10 11 12 13 14 15 16 17 18 19 2 20 21 22 23 3 4 5 6 7 8 9 I have 29 bars: 0 1 10 11 12 13 14 15 16 17 18 19 2 20 21 22 23 24 25 26 27 28 3 4 5 6 7 8 9 The first foo is 0 The last bar is 9