in reply to enforcing list context

You could enforce list context like your title says if you really liked to.

use Carp 'confess'; sub your_code { confess "List context is required" unless wantarray ... }

⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Replies are listed 'Best First'.
Re^2: enforcing list context
by billh (Pilgrim) on Apr 26, 2006 at 21:00 UTC
    I guess my title is probably somewat misleading, it probably should have read:
    "ensuring list context in an enclosing scalar context"
    -----
    perl -e 'print sub { "Hello @{[shift]}!\n" }->("World")'