Well, you can, but you just have to use an alternate syntax:
my $var = [foo()];
In this case, you should know in advance that foo() returns a list that you want to take as an array reference. If a scalar is returned, it will automatically be populated as the first element in the array reference, regardless of its type.
In reply to Re: Reference to return value of a subroutine
by stevieb
in thread Reference to return value of a subroutine
by Christina
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |