in reply to hard referencing in hashes?!?
How about something like this:
#! /usr/bin/perl use strict ; use warnings ; use Data::Dumper ; my @match_arr = qw( count pick words ) ; my %match_hash = map { $_ => 1 } @match_arr ; my %word_count ; while ( <DATA> ) { my @words = split ; for ( @words ) { $word_count{$_}++ if $match_hash{$_} } } print Dumper \%word_count ; exit ; __DATA__ This is my data. I will first count all the words herein, then pick and choose the data I want. I can pick the words using grep.
Those who know that they are profound strive for clarity. Those who
would like to seem profound to the crowd strive for obscurity.
--Friedrich Nietzsche
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: hard referencing in hashes?!?
by imlou (Sexton) on Nov 08, 2002 at 02:56 UTC | |
by DamnDirtyApe (Curate) on Nov 08, 2002 at 04:08 UTC | |
by BUU (Prior) on Nov 08, 2002 at 03:11 UTC |