Indexing a list needs parens:
sub giveList{ 1 .. 10 };; print +( giveList() )[ 2 ];; 3
Note: the unary + is to avoid the intensely annoying: print (...) interpreted as function ...
In reply to Re: Pick a single item from a sub's return list
by BrowserUk
in thread [Solved] Pick a single item from a sub's return list
by davies
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |