Monday, January 24, 2011

perl: no of element count

open(IN, "VersR-R 02-11.html") || die "Input file cann't open: $!";
read (IN, $file, -s IN);
close IN;

while($file =~ s/<(([A-Za-z]+)\s*[^>]*)>//i) {
$hash{$2}++;
}

print "$_\t$hash{$_}\n" foreach (keys %hash);

No comments: