Quote:
I am newbie to perl, just curious to know how to do the following in perl.
suppose I ve a txt file like below. when it founds "*Main Start"
Then go to "*Main End,,,,,,,," patteren and just collect the number from the previous line of "*Main End,,,,,,," pattern . In my case it is 5 . Then start excuting normally from the "*Main Start" position
|
You could use the Tie::File module for this which avoids the brute approach "era" mentioned. With Tie::File you treat a file like a
perl array, so if you find a pattern in a certain line you just use simple array indexing to go back one line in the file. See the Tie::File (a
perl core module) documentation for usage details.