> > $val = (foo())[0];
> >
> > List?
>
> Scalar, obviously.
How do you figure that? (Not a criticism: I'd really like to understand your
thought process here so I can assess the relative DWIMity of the two
alternatives).
> With a possible runtime error if foo doesn't return
> an arrayref. And that should probably written as:
>
> $val = foo().[0]
Or even:
$val = foo.[0];
Or even:
$val = foo[0];
Note that, in these last three versions, foo() is indeed called in a
scalar context, specifically a scalar array ref context.
(!)
Damian