while ( ) { chomp; next if /[^a-z]/; # Lazy way out~ push @{ $wordlist{ length() } }, $_; }