I have a nice page for you to look at regarding "regular expressions" or "regex". Now, Regex is nice, but can be a bit confusing. Line Noise, as it's been called, can do magic, however, with a correctly set up expression, or expressions. I see that you tried with "m" which is the regular expression for "matching". In Perl, it defaults to m, so you could have done the same with just // instead of m//, but it's always better for readable to use the m. Here is a great page to learn and understand regex:
http://www.troubleshooters.com/codecorn/littperl/perlreg.htm
I hope this helps some. If you are still having mad troubles with it, I'll be glad to take a look at your code, and offer what help I can. Also, I don't see you opening a file to read the input from. The while (<>) { actually is trying to read input from STDIN, unless you have changed that somewhere previously.
open(FH "/home/mydir/somefile.txt");
while (<FH>) {
}
close(FH);
The Above is the best way IMO to go about this. It helps in readability... you are opening the file, using the filehandle FH. Then, In The While Loop, You Are Reading from FH (), line by line until it finds the EOF (end of file) character.
Also something to consider, is using the split function to get each of the information in the file in such . For example, when I parse an HTML Page with Perl I do something like this:
@tags = split(/</, $_);
foreach $tag (@tags) {
if (lc($tag) eq "b>") {
print "Found Bold Tag\n";
}
} And You Could Use Similar code to read your file, and then check which "tag" you are on.... it doesn't like look what you want to do is going to be an easy task, but let me know if I can help any further.