[Israel.pm] regex question
dovalle at smlink.com
Sun Jan 25 06:16:43 PST 2004
You should distinguish between whether or not the "On Error" statement fits Subs & Functions.
#Now for same statement
* While parsing each file rise a flag while the line starts with Sub/function # e.g. $fInsideFunc = 1
* Write each line to another file
* If "On error" statement appears - rise another flag # e.g. $fOnError = 1
* If "End.." statement appears check the flags status
o In case both =1 make them to be 0 and continue
o In case only the first =1 write the " On error " statement, make them = 0 and continue
Don't forget to close both files
If you have 2 "On error statements" you should define 2 variables e.g. $fInsideFunc, $fInsideSub and basically do the same.
If the "on error" statement cant be the last command before "end" please spread a little about your requirements...
From: Yuval Zaltz [mailto:Yuval.Zaltz at Tescom.co.il]
Sent: Sunday, January 25, 2004 15:48
To: perl at perl.org.il
Subject: [Israel.pm] regex question
I need to parse a VB file that contains Functions and Subs.
In each subroutine and function I need to identify if the string "On Error" exists
and if not add it.
what is the most efficient way to do this in regex?
The file looks like this :
On Error ...
Perl mailing list
Perl at perl.org.il
More information about the Perl