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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parse line to determine if variable is set

Status
Not open for further replies.

CJason

Programmer
Joined
Oct 13, 2004
Messages
223
Location
US
I want to parse a line of code to determine if a variable is being set or being used. For example:

A = 9

If I parse this correctly, it would tell me that "A" is being set.

HELLO = A

If I parse this correctly, it would tell me that "A" is being used.

A = A + 5

If I parse this correctly, it would tell me that "A" is being set AND used.

FYI, I can't really use:
/\bA\b\s*=/
because of this case:
HELLO(A) = 9

Does anyone have a good way of doing this? Thanks in advance!!!
 
If you want to step through the code, use the -d option:
perl -d <file.pl>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top