You're right; I'm not using 'use strict;' at the moment.  But if I
declare a variable called '$nothing' in a script on working on now, I
get:

  Useless use of a variable in void context at mail_test line 11.
  Name "main::nothing" used only once: possible typo at mail_test line
11.

If I use 'use strict;' I get a flurry of other messages ;).

my $perl_experience = n00b


-----Original Message-----
From: Wagner, David --- Senior Programmer Analyst --- WGO
[mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 08, 2005 3:21 PM
To: Ryan Frantz; Troy S; beginners@perl.org
Subject: RE: perl question - unused variables

Ryan Frantz wrote:
> I'm (very) new to Perl but I thought there was an easier way to do
> this. I use the '-w' switch when specifying my interpreter at the
> beginning of my script:
> 
> #!/usr/bin/perl -w
> 
> and it always tells me if I have a declared variable that doesn't get
> used.
> 
> ry

        You are not using strict because if so then declaring say my
$abc; and using strict and -w, I do not get any warning.  Hopefully one
of Perl gurus can enlighten us.

Wags ;)
> 
> -----Original Message-----
> From: Bob Showalter [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 08, 2005 2:52 PM
> To: 'Troy S'; beginners@perl.org
> Subject: RE: perl question - unused variables
> 
> Troy S wrote:
>> How can i automatically detect unused variables in Perl?
>> 
>> i delcrae variables like:
>> my $abc;
>> 
>> but don't use $abc within the subroutine.
>> 
>> how can i get perl to autmatically tell me that $abc is not being
>> used (other than the declaration)????
> 
> Possibly use the output of B::Xref to look for variables with only an
> introduction ("i")?
> 
> perldoc B::Xref
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>



*******************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
*******************************************************


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to