[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Counting Words



I am trying to get a word count from a string.

$a="This is some sample text."

I have tried this and it does not work:
$returncount=0;
 @words=split(/\ /,$a);
 foreach $trash(sort keys(@words)){
  $returncount++;
 }

I am getting an odd number of elements in hash array error.

Any help would be greatly appreciated.  Thanks in advance.

--
Michael D. Kirkpatrick
Vice-President
Web Builders Internet Services Inc.
http://www.webbuilders.com



===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org