in reply to Re: How can I read and print lines that has only one word from a file
in thread How can I read and print lines that has only one word from a file
You can call this with either one file, or as many as you like. The double-angle-brackets just read in anything from @ARGV. Further, it looks for a single group of "non-space" characters. This includes things with punctuation and such.while (<>) { print if (/^\s*\S+\s*$/); }
|
|---|