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

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

Fergal Daly
August 28, 2003 11:22
Re: [perl #23630] problem with "used only once" warning
Message ID:
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 
> > 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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About