in reply to stuck at "Use of uninitialized value in length at ..."
Instead of using length, which counts the line terminator as Marshall discovered, you could test with a regular expression for 5 or 6 characters between beginning and end of string anchors. The task could be done as a one-liner like this.
$ perl -ne 'print if m{^.{5,6}$};' all_words.txt >> trimmed_words.txt $
Change the >> to > if you are not appending to the file. I hope this is of interest.
Cheers,
JohnGG
|
|---|