in reply to Sometimes it's in Void Context
I was half right. The warning comes from op.c, specifically Perl_scalarvoid. When it hits a constant op, it checks to see if it should throw a bareword warning. Otherwise, if it needs to warn about useless constants in void context, it does. There's a hack, though, like I thought, but the comment says:
/* the constants 0 and 1 are permitted as they are conventionally used as dummies in constructs like 1 while some_condition_with_side_effects; */
|
|---|