in reply to A regex question.
It seems to me that your problem is in your control mechanisms, specifically that your if statement should be inside of a while statement that goes through your data line by line. Also maybe a global variable to keep track of matches. If you're reading a file, then you'll have something like:
my $matches = 0; open FILE, ">filename.txt" or die $!; while (my $ethernet = <FILE>) {
if ($ethernet=~/eth1\.\d{4}\@/m){ ## do something matches++; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: A regex question.
by 1nickt (Canon) on Aug 01, 2015 at 14:42 UTC |