> [EMAIL PROTECTED] - Fri Jan 05 01:38:47 2001]: > > Maybe there's a reason for it, but... > > ~ 12:35:18$ perl -wce '$count = 1;' > Name "main::count" used only once: possible typo at -e line 1. > -e syntax OK > > BUT... > > ~ 12:35:52$ perl -wce 'my $count = 1;' > -e syntax OK > > Shouldn't that warning be raised, regardless of scope?
I agree. In fact the argument for the warning is even stronger for a lexical. A global seen only once... well maybe some other package grabs at it. But a lexical declared but never used is useless. About the only counter argument I can see is that issuing the warning for lexicals will cause a lot of existing code to start yelping. But that's what warnings are for. I for one would like to know about unused lexicals.