It looks like you pasted together a couple bits of code that do something similar to what you're trying to do, but together they don't actually work, and they're really not what you want anyway. You could do this task by slurping the entire file into a single string and then stepping through it by using a //g regex in a while test, but it'd look more like this:
while($huge_multi_line_string =~ /ccParty<(\S+)> Port<(\S+)> DTMF<(\S+ +)>/g){ # do something with $1, $2, and $3 }
But don't do that, because that's an ugly way to do it, especially with large files, since it means pulling the whole file into memory. You don't want to do that unless it's necessary, and it's not in your case. Start by thinking through your problem, and how you'd solve it logically, before getting into the code. Write pseudo-code if you have to. You've got a bunch of lines, and you want to pick out the lines that contain certain strings. So your logic will be:
open the file while there are more lines, get a line if the line matches certain strings do something with it close the file
Then it's just a matter of turning it into code. In perl, "while there are more lines, get a line" is normally done by using <angle brackets> around a filehandle in a while test. This returns one line from the filehandle to a scalar variable, or to $_ if you didn't specify a variable. Then within your while loop, you can use a regex (or regexes) to see if your line matches your requirements. A little time spent reading about using a while loop to read a file line-by-line, and some more time spent in perlretut, and you should be close, at least.
Aaron B.
My Woefully Neglected Blog, where I occasionally mention Perl.
In reply to Re^2: Perl = Greek to me
by aaron_baugher
in thread Perl = Greek to me
by smolikmd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |