#! /bin/perl main(); sub main { print "\n\nFile to check: "; local $fname = ; LoopChk1(); } sub LoopChk1() { print "\nIgnore length of (# of lines or blank): "; my $iglen = ; chomp($iglen); my @linecnt; print "\noutput file or blank: "; my $outpf = ; chomp($outpf); die unless open(DATA, "$fname"); if ($outpf) { die unless open(OUTP, ">>$outpf"); } my ($line, $topval, $count); while ($line = ) { next if ($line !~ /(\d+)/); $topval = $1; $line = ; # skip "-------------"; for ($count = 0; (($line = ) =~ /\d+/); $count++) {;} if ($iglen) { print("\n$topval : $count\n") if ($count != $iglen); } if ($outpf) { print(OUTP "\n$topval : $count\n") if ($count != $iglen); } $linecnt[$count]++; } print "\n"; my $i; for ($i = 1; $i <= 20; $i++) { print("There are " . $linecnt[$i] . " loops of $i.\n"); } }