use strict ; use warnings ; sub test { return wantarray ? qw(test) : scalar @{[qw(test)]}; } my $test = test() ; my @test = test() ; print ">>> $test\n" ; print map "[$_]\n",@test ; print $test == scalar(@test)? "Yepa!\n" : "Nope!\n" ; __output__ >>> 1 [test] Yepa!