in reply to Re: Bitten by the || bug
in thread Bitten by the || bug

s/void/scalar/, as should be expected since @{} wants a reference to an array, not a list of anything.

- tye        

Replies are listed 'Best First'.
Re^3: Bitten by the || bug (@{})
by Aristotle (Chancellor) on Feb 21, 2006 at 01:37 UTC

    So it is scalar context. (Thanks for the correction on wantarray.)

    By way of an explanation: I misremembered the issue I had in mind. What I was thinking of is that the scalar reference-taking operator \ evaluates its argument in list context. This came up in discussion of the (ab)use of @{[]} or ${\()} constructs to put code inside here-docs.

    Makeshifts last the longest.

Re^3: Bitten by the || bug (@{})
by Aristotle (Chancellor) on Feb 20, 2006 at 18:34 UTC
    $ perl -le'print @{warn wantarray ? 1 : defined wantarray ? 0 : "undef +"}' undef at -e line 1.

    Nope, void context.

    Makeshifts last the longest.

      You've misused wantarray. It tells the context in which the current subroutine was called, not in what context wantarray was called.

      > perl sub context { warn !defined wantarray ? "void" : wantarray ? "list" : "scalar", $/; } @{context()}; <EOF> scalar

      - tye