in reply to undefined value as an ARRAY reference sometimes ok
EXPR1->[ EXPR2 ]
is short for
( EXPR1 //= [] )->[ EXPR2 ]
This makes sense:
$list //= []
This doesn't make sense:
get_no_list() //= []
You can't assign to a non-lvalue function.
If you want the first element of a list, you can use a list slice.
( some_list() )[0] # Returns the first element or an empty list.
|
|---|