Counting HTML / XML Tags from stdin

Perl Add comments

#!/usr/bin/perl

undef $/; # enable "slurp" mode
$_ = <>; # whole file now here
$/ = \1234; # set back

while ( /< (([^ >]|\n)*?)>/ ) {
$count++;
print “$count. $&\n”;
$_ = $’;
}

Leave a Reply

You must be logged in to post a comment.

WebSite Powered by webHauser
Entries RSS Comments RSS Login