in reply to Re: Sorting words, keeping only words that start with a letter and contain only letter characters, and hypens, and end in a letter
in thread Sorting words, keeping only certain words

this is my code, can i not do this? it doesn't seem to filter any words out when i do.
foreach $word (split){ if($word =~ /^[a-zA-Z]([a-zA-Z]*|-[a-zA-Z])*$/){ $count{$word}; }
}
  • Comment on Re: Re: Sorting words, keeping only words that start with a letter and contain only letter characters, and hypens, and end in a letter
  • Download Code

Replies are listed 'Best First'.
Re: Re: Re: Sorting words, keeping only words that start with a letter and contain only letter characters, and hypens, and end in a letter
by Ido (Hermit) on Nov 10, 2002 at 23:17 UTC
    Try $count{$word}=1;....
      yeah sorry i forgot the ++ after my $count{word}; it should be$count{word}++;