Perl script to do a word count (subroutines, hashes, foreach array, split) cesine 2 years ago Perl script to do a word count (subroutines, hashes, foreach array, split) This is a short perl script that counts words in a string. The script illustrates the use of subroutines, hashes, foreach loops on arrays and the split command.