#!/usr/bin/perl -w # Check that input text matches the expected width and height. use strict; if( $#ARGV < 1 ) { die "$0 {width} {height}\n"; } my $width = shift @ARGV; my $height = shift @ARGV; # Check widths. my ($line_number, $line); for($line_number = 1; $line = <>; $line_number++) { chomp $line; my $i = length($line); if( $i != $width ) { die "Line $line_number contains $i columns, expected $width\n"; } } # Check height. --$line_number; if( $line_number != $height ) { die "Got $line_number lines, expected $height\n"; } # Success. exit 0;