Alternatively, return a reference:
sub givelist { [ 1 .. 10 ] } say givelist()->[ 2 ];
Update: In fact, if the sub is declared before it's called (as above), the call can be simplified to:
say givelist->[ 2 ];In reply to Re: [Solved] Pick a single item from a sub's return list
by Not_a_Number
in thread [Solved] Pick a single item from a sub's return list
by davies
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |