Syntactic Confectionery Delight | |
PerlMonks |
Re: Counting and Filtering Words From Fileby jwkrahn (Abbot) |
on May 09, 2020 at 22:49 UTC ( [id://11116629]=note: print w/replies, xml ) | Need Help?? |
I don't understand your "list of excluded characters". In the bash version you are using tr which only works on characters but in the Perl version your list uses two character strings instead of single characters. Also, Perl has a tr/// operator which operates pretty much the same as the command line tool (on single characters). Your "list of excluded words" would probably be better as a hash. Reading a file a line at a time shouldn't be a problem as Perl IO is buffered, however, you can change how much data is read in by changing the Input Record Separator ($/) to read in a whole file. The comment in your program says "# remove non-letter characters", however you are only removing certain punctuation characters. Perhaps you want something like this:
In Section
Seekers of Perl Wisdom
|
|