in reply to stuck at "Use of uninitialized value in length at ..."

Here's my version:

use strict; my $input = "words.txt"; my $output = "output.txt"; open my $ifh, '<', $input or die "can't open $input : $!\n"; open my $ofh, '>', $output or die "can't open $output : $!\n"; while (my $line = <$ifh>) { chomp $line; my $word_size = length($line); if ($word_size == 5 || $word_size == 6) { print $ofh "$line\n"; } } close $ifh; close $ofh;