$numHeaders= $ARGV[0]; $numFooters= $ARGV[1]; #count number of lines in file open (INPUT, $l_infile); for (){}; $numLines= $.; close(INPUT); open (INPUT, $l_infile); while() { my @fields = split "," , $_; if ($. != $numHeaders && $. <= $numLines-$numFooters) { # do parsing work and print } } close (INPUT);