in reply to Pair Tag missing
#!/usr/bin/perl -w use strict; my ($tagOpen, $tagClosed, $parseData); open(FILE, "<", 'htmlFile.html') || die "Error reading file: ($!)\n"; $parseData .= $_."\n" while (<FILE>); close(FILE); my @tags = qw(TITLE AUTHOR H1 H2 P IT); for (@tags) { $tagOpen++ while ($parseData =~ /<$_>/g); $tagClosed++ while ($parseData =~ /<\/$_>/g); error($_, $tagOpen, $tagClosed) unless ($tagOpen == $tagClosed); $tagOpen = $tagClosed = 0; } sub error { my ($tag, $open, $closed) = @_; print "Error found in tag: <$tag> (Open: $open -- Closed: $closed)\ +n"; return; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Pair Tag missing
by graff (Chancellor) on May 31, 2005 at 04:11 UTC | |
by Elijah (Hermit) on May 31, 2005 at 12:42 UTC |