#!/usr/bin/perl use strict; use warnings; my $filein=shift(@ARGV) or '-'; my $fileout=shift(@ARGV) or '-'; my $min=@ARGV?shift(@ARGV):10; my $max=@ARGV?shift(@ARGV):15; my $fhin=\*STDIN; if($filein ne '-'){ open(my $fhin, '<', $filein) or die "OPEN $filein $!\n"; } my $fhout=\*STDOUT; if($fileout ne '-'){ open($fhout,'>',$fileout) or die "OPEN $fileout $!\n"; } while(my $line=<$fhin>) { chomp($line); my $l=length($line); print $fhout "$line\n" if($l>$min and $l<$max); } close($fhout); close($fhin);