We don't bite newbies here... much | |
PerlMonks |
Re: Reference to return value of a subroutineby golux (Chaplain) |
on Apr 02, 2017 at 13:56 UTC ( [id://1186718]=note: print w/replies, xml ) | Need Help?? |
You can take the reference of a subroutine's return value. You did just that, and can see it with:
To make it more obvious, try this:
What's happening is that you're returning a list that gets evaluated in scalar context, whose behavior is to take the last item of the list. If you want to capture the whole list, try returning an ARRAY reference instead (then you don't even need the extra reference):
In Section
Seekers of Perl Wisdom
|
|