Hi usertest,
What if the START and END tags are not as simple
Did you try out the code that Athanasius posted above? Was the output as you expected it or not?
The regular expressions that Athanasius used will match the words "START" and "END" anywhere in the line, so at least with this sample data you posted it works the same.
why this statement $flag =~ /E0$/ and how it works
This regular expression tests for a special value returned by the range operator in scalar context aka flip-flop operator: it marks the end of a range (see the link for all the details). That means that in this case, the condition is true when an "END" is encountered, then the code checks whether it $found a "def" string and acts appropriately, either printing the lines it captured or not.
Hope this helps,
-- Hauke D
In reply to Re^3: Perl code help
by haukex
in thread Perl code help
by usertest
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |