in reply to [Solved] Pick a single item from a sub's return list
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 ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Pick a single item from a sub's return list
by roho (Bishop) on Oct 31, 2015 at 12:41 UTC | |
by BrowserUk (Patriarch) on Oct 31, 2015 at 13:01 UTC |