A warning for subs that you declare but then don't use would be really annoying for those who are doing more advanced things behind-the-scenes. I might want to declare a subroutine name, but then define it at run-time.Indeed in the very same script I had
although I bet that many Perl hackers wouldn't regard this as a good practice.sub killp; *killp = DEBUG ? \&_killp_debug : \&_killp_real;
However we already do e.g.
all the time. A 'used only once' warning as suggested by someone else wouldn't be that bad after all.no strict 'refs'; # and no warnings 'uninitialized';
I don't run into this problem because I like parens that give perl a bit of extra help with the parsing (and keep maintenance programmers from getting too confused too).Well, that's to a very large extent a matter of personal preferences, just like so many other things in Perl. I find code having as few parentheses as possible to be best readable.
In reply to Re^2: Warning for "unused sub declarations"?
by blazar
in thread Warning for "unused sub declarations"?
by blazar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |