Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extract Unique Variable Names

Status
Not open for further replies.

duckiebear

Programmer
May 25, 2004
32
0
0
US
Does anyone have a script or can guide me in writing a script that will run through my program and create a list of all my unique variable name? My goal is to avoid errors due to typos. By creating a list of unique variable names, excluding duplicates, I could look through and more easily notice a typo in a variable name.
 
You should just use warnings and the strict pragma. That way, you'll get an error message if you use a variable you haven't already declared. That's the normal way to avoid these types of problems. Simply start each script with:
Code:
#!/usr/bin/perl -w
use strict;
 
Thank you. Regardless, I would still like the a program to pull this out, as I am inheriting many programs from a previous owner, and it would make things much easier.
 
have a look at B::Xref, seems to do what you need.

file://C:\Perl\html\lib\B\Xref.html on my system

Mike

"Deliver me from the bane of civilised life; teddy bear envy."

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top