in reply to Detecting type of output from subs

If you don't know what the subroutine does, then maybe you shouldn't be calling it! The context is all important, and there is a difference between returning an array and returning a list when used in scalar context. Consider:
use strict; use warnings; sub mysuba { my @fred = qw(The quick brown fox); return @fred } sub mysubb { return qw(The quick brown fox) } my $resa = mysuba(); print "$resa\n"; my $resb = mysubb(); print "$resb\n";
Gives:
4 fox
So you do have to be careful of context, and what the subroutine returns.

(There are many other party tricks you can play with this - which just goes to show the kind of parties I get invited to).