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

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

From:
Fergal Daly
Date:
August 28, 2003 11:22
Subject:
Re: [perl #23630] problem with "used only once" warning
Message ID:
200308281921.26344.fergal@esatclear.ie
On Thursday 28 August 2003 18:11, John Peacock 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.  

That's what I assumed. What's the difference between a bug and a bad 
side-effect of the implementation which disgarees with the documentation? 

I suppose I should say "disagrees with the obvious interpretation of the 
documentation" because

        Name "%s::%s" used only once: possible typo
           (W once) Typographical errors often show up as unique variable
           names.  If you had a good reason for having a unique name, then
           just mention it again somehow to suppress the message.  The "our"
           declaration is provided for this purpose.

speaks about variable names rather than variables but I wonder how many people 
get that the subtle distinction without finding out the hard way,

 F




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