in reply to Re^2: Bitten by the || bug (@{})
in thread Bitten by the || bug

$ perl -le'print @{warn wantarray ? 1 : defined wantarray ? 0 : "undef +"}' undef at -e line 1.

Nope, void context.

Makeshifts last the longest.

Replies are listed 'Best First'.
Re^4: Bitten by the || bug (@{})
by tye (Sage) on Feb 20, 2006 at 18:52 UTC

    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