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

-----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>



--
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