in reply to hash to count words
Please use "code" tags correctly, as described in Writeup Formatting Tips.
Your regex "$word =~ s/^\w\x\//g;" is invalid.
you probably want:
Your re-initilazation of "%hash=()" within the loop makes the hash useless.$word=~s/[^\w]//g; # Eliminate non-word chars
Declare it outside the loop, and add data to it using
Later , you can get a list of words found by accessing:$hash{$word}++; # Get a count of the word
Please try to follow davido's excellent advice in response to your previous question on the same subject.keys (%hash)
I hope life isn't a big joke, because I don't get it.
-SNL
In Section
Seekers of Perl Wisdom