A reference is a scalar (by definition), even if what it refers to isn't. So I'm not quite sure what you mean by "assign an array variable to an array reference instead of to scalar variables." You can push
array references into normal arrays as members and then dereference them straightforwardly. You can also return references from subroutines.
You could dereference the return value of a subroutine in the assignment. I wonder if this is the kind of thing you are trying to do?
my @array = @{ some_sub() };
Note that as Axeman comments below this isn't itself a good idea or especially necessary. If what you really want is to get the items out of the sub-routine and then into arrays, Depesz's suggestion is the kind of thing you need.
I highly recommend perldoc perlreftut
as an introduction to references in Perl. You might also look at perldoc perllol
and perldoc perldsc
.
It might help if you explain what you're really trying to do and why?