in reply to Help with accepting inputs, wordcount, and print to a file
In general, consider placing the following at the top of your scripts:
use strict; use warnings;
strict and warnings will prevent many headaches by preemptively catching problem areas in your code, if any.
Also, if you decide to go the hash route to count words, keep in mind that "word" will be a different key from "Word" in that hash, since keys are case sensitive. To remedy this, you can use lc to first convert all the string's letters to lower-case or uc to convert all the string's letters to to upper-case, before using that string as a hash key.
|
|---|