Well, as I wrote some time ago, one such use are subroutines that just produce data and behave different in void, scalar and list context
$thingy -> foo (1,2); # results printed to current filehandl +e $string = $thingy -> foo (1,2); # results returned as a single string @lines = $thingy -> foo (1,2); # results returned as a bunch of lines
which works fine and is just fine - if documented.
Another such use would be subroutines which behave like google's "I feel lucky" (scalar) vs. "normal" (list) search.
I agree with you that good uses of wantarray are rare, and the only type of prototype I use now and then is '&', which lets me write subs that get passed blocks, like map or sort.
I don't consider Contextual::Return to be a "good use" mostly because it does the same thing only moreso.
That statement contradicts the OP's last heading - "Better" versions of wantarray.
In reply to Re^3: Use of wantarray Considered Harmful (bad use)
by shmem
in thread Use of wantarray Considered Harmful
by kyle
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |