#!/usr/bin/perl -w use strict; my %foo; while (<DATA>) { $foo{$1}++ if (/(\d+) is good/) } print "$_ :: $foo{$_} \n" foreach (keys %foo); __DATA__ <HR> 1 is good<BR> useless data<BR> useless data<BR> useless data<BR> useless data<BR> <HR> 2 is not good <BR> useless data<BR> useless data<BR> useless data<BR> useless data<BR> <HR> 3 is good<BR> useless data<BR> useless data<BR> useless data<BR> useless data<BR> <HR> 4 is not good <BR> useless data<BR> useless data<BR> useless data<BR> useless data<BR> <HR>
In reply to Re: parsing with regex
by Sifmole
in thread parsing with regex
by 2501
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |