Forcing an rvalue context on a scalar expression


foo (@q ? $q [-1] : undef);

But this is focusing too closely on the simplified example used to illustrate the question and not the actual question!

A more realistic example would be something like:

foo(func()->[-1]); # where func() is quite expensive

The best answer I got was.

foo( @{[ func()->[-1] ]} );