maybe perl should catch constants here too

Niko Tyni ntyni at debian.org
Wed May 7 20:17:07 UTC 2014


On Thu, May 01, 2014 at 12:20:43PM +0800, 積丹尼 Dan Jacobson wrote:
> Maybe perl should catch constants here too:
> $ perl -wle '"\n"'
> Useless use of a constant ("\n") in void context at -e line 1.
> $ perl -wle 'sub k{"\n";}'
> $

This is a wrong address for bug reports or feature requests.  We have
a bug tracking system for those.

That said, I'm not sure what you want to be warned of in the second
case. That use of a constant isn't useless if the function k() ever gets
called in a non-void context.

Of course, in your example program k() is never called, but that means
the whole subroutine is useless, not the use of a constant as its return
value.
-- 
Niko Tyni   ntyni at debian.org




More information about the Perl-maintainers mailing list