Gives:use warnings; use strict; sub mysub1 { my @fred = qw(The quick brown fox); return @fred; } sub mysub2 { return qw(The quick brown fox); } my $x = mysub1(); print "x: $x\n"; my $y = mysub2(); print "y: $y\n";
You could always use wantarray to return a list or a scalar, depending on the context.x: 4 y: fox
In reply to Re: most appropriate return data type
by cdarke
in thread most appropriate return data type
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |