For dealing with the comments, I would just wipe out the comment part of each line immediately after reading it. You could do this either using the s/// operator (see the section Regexp Quote-Like Operators in perlop), or using index and substr. The former would be the more "perlish" solution. The latter might look more familiar to you if you come from a language such as C.
In reply to Re^3: Extracting pattern from a file
by rovf
in thread Extracting pattern from a file
by ghosh123
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |