in reply to How to validate file format

perl script.pl filename
#!/usr/bin/perl my $s; while (<>) { my ( $tag, $value ) = /^<(main|sub(\d+))>/ or print STDERR "wrong tag on line $.\n" and next; $s = 0, next if $tag eq 'main'; next if $value == ++$s; print STDERR "wrong sub expect $s got $value in line $.\n"; $s = $value; } __OUTPUT__ wrong sub expect 2 got 3 in line 4 wrong sub expect 1 got 2 in line 6
Boris