#!/usr/bin/env perl -l use strict; use warnings; my %tags; while (<>) { ++$tags{$1} while /<(?!\/)([^ >]+)/g; } print "$_\t$tags{$_}" for sort { $tags{$b} <=> $tags{$a} } keys %tags; #### $ ls -l pm_1082082_*.html -rw-r--r-- 1 ken staff 237 13 Apr 12:13 pm_1082082_1.html -rw-r--r-- 1 ken staff 237 13 Apr 12:12 pm_1082082_2.html #### $ cat pm_1082082_1.html

Heading 1

Some bold and italic text.

Heading 1.2

Para1 (1.2.1)

Para2 (1.2.2)

Fake newlines:


##
## $ cat pm_1082082_2.html

Heading 2

Some bold and italic text.

Heading 2.2

Para1 (2.2.1)

Para2 (2.2.2)

Fake newlines:


##
## $ pm_1082082_html_tag_count.pl pm_1082082_*.html p 8 br 6 strong 4 h1 2 em 2 h2 2