If it was my script, I'd write it like this:
#! /usr/local/bin/perl -w
use strict;
die "Not enough params!!!\n" if @ARGV < 3;
my ($input, $output, $length) = @ARGV;
open INPUT, $input or die "unable to open $input: $!\n";
open OUTFILE, ">$output" or die "unable to open $output: $!\n";
my $count = 1;
while (<INPUT>) {
chomp;
++$count if />/;
if (length >= $length)
print ">$count\n$_\n\n";
print OUTFILE ">$count\n$_\n\n";
}
}
close INPUT;
close OUTFILE;
--
<
http://www.dave.org.uk>
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg