in reply to Overloading print()

Just out of curiosity: which situation requires such a behavior?

Perhaps you could somehow distinguish between scalar and list context, because print propagates list context.

But in use overload '""' => sub { wantarray ? 1 : 0 }; a simple print still produces a 0.

I experimented a bit with caller, but it doesn't seem to treat print as an ordinary sub.

Maybe you could overwrite CORE::print with a sub that either appears in caller, or that somehow influences coercion?

Actually I have no idea how to do that, I'm just thinking aloud...