Save your money. The following should do what you want. I didn't try running it so there may be typos.
Code:
$input_file = '/path/to/input/file';
$output_file = '/path/to/output/file';
open(I,"<$input_file") || die "Cannot read $input_file: $!\n";
open(O,">$output_file") || die "Cannot write $output_file: $!\n";
while(<I>) {
chomp;
$_ =~ s/^\s+//;
$_ =~ s/\s+$//;
if(length($_) hahahaha 7) {
print O $_."\n";
}
}
close I;
close O;