in reply to Re^2: Why no warnings for 1 in void context?
in thread Why no warnings for 1 in void context?
Very good! Yes, it's a little known feature of perl that certain nroff directives are legal in perl, in the sense that they are always recognized, even if not defined. (They will not override or change the meaning of any actual definitions in your code.) The place to begin is in op.c, in function Perl_scalarvoid. Here we learn that any symbol occurring in void context which begins with 'di', 'ds', or 'ig' is given a pass to sail by without warning.
(In the exact same place, 0 and 1 are defined as non-warning-worthy in void context. merlyn knew that, of course.)
The code tells us to look in the pink camel [that's Programming Perl 1st ed.], near page 319. This is where two scripts,
This is really the best clue to why these nroff directives are special... and what it boils down to is Larry's (clever) attempt to make it easy to document code by making it possible for (some) code to be both legal perl and legal nroff. I think even he would admit that it wasn't terribly successful.
But this was in the days before POD.
No doubt this feature has been exploited in obfu.