develooper Front page | perl.perl5.porters | Postings from August 2003

Re: [perl #23630] problem with "used only once" warning

From:
John Peacock
Date:
August 28, 2003 10:12
Subject:
Re: [perl #23630] problem with "used only once" warning
Message ID:
3F4E37D4.7000303@rowman.com
fergal@esatclear.ie (via RT) wrote:

>>perl -we '$c,@c'
> 
> Useless use of a variable in void context at -e line 1.
> Useless use of a variable in void context at -e line 1.
> 
> Although $c and @c are each used only once there is no warning for either of 
> them.
> 

I don't think this is a bug, but rather a side effect of the implementation. 
'main::c' is referring to the glob *c, which both $c and @c are a part of.  You 
can confirm that by doing this:

$ perl -we '$c,@d'
Useless use of a variable in void context at -e line 1.
Useless use of a variable in void context at -e line 1.
Name "main::d" used only once: possible typo at -e line 1.
Name "main::c" used only once: possible typo at -e line 1.

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD  20706
301-459-3366 x.5010
fax 301-429-5748





nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About