in reply to Re: Re: hard referencing in hashes?!?
in thread hard referencing in hashes?!?

$word_list{$_}++ for @words; @sorted = sort keys %word_list;

Replies are listed 'Best First'.
Re: Re: Re: Re: hard referencing in hashes?!?
by PodMaster (Abbot) on Nov 08, 2002 at 14:26 UTC
    @word_list{@words}=1; @sorted = sort keys %word_list;

    update:
    Oh come on, that shift+9 shift+0 ... 3 extra keys man ... *me*shakes*head* ... whatever happened to lazyness ???

    :D

    ____________________________________________________
    ** The Third rule of perl club is a statement of fact: pod is sexy.

Re: Re: Re: Re: hard referencing in hashes?!?
by imlou (Sexton) on Nov 08, 2002 at 16:23 UTC
    Thanks for all your help guys! I was wondering how I would be able to get word123 into my @word but not 456. So that word123 would be a word, but 456 isn't a word. Right now I have
    my @words = map {s/[.,!\W\?]\B//g; split; } <FILE>;
    With this i'm getting it to keep word123 but if its 39 it would remove the 3 but not the 9? Also if I add an i (case insensitive) behind the /g would that give me There = there?
      It doesn't seem to me that you want to be altering any of the words; you're writing a pure filter. (Right?)

      So I'd probably do this:

      my @words = grep { /^[a-z]/i } map { split } <FILE>;
      The map produces a list of all the "words" in the file; the grep filters out any that don't begin with a letter. If you need to remove punctuation and stuff like that (if you said you did, I missed that), then you could modify the split accordingly:         map { split /\W+/ } hth,

      jdporter
      ...porque es dificil estar guapo y blanco.