On Mon, 17 May 1999 robinmcf@altern.org wrote: > I'm working on a script that reads in a text file and a dictionary file and > uses the dictionary file to process the text file in terms of word > frequency and /or manipulation through regex matching- > armed with Learning Perl (the blue Llama), Programming Perl (the blue > camel) and Advanced Perl Programming (the black panther standing on a blue > box) and the PODs I _cannot_ find anything to help me achieve this end > (that I can understand) > > This snippet from perlfaq6: > while (<>) { > while ( /(\b[^\W_\d][\w'-]+\b)/g ) { # misses "`sheep'" > $seen{$1}++; > } > } > while ( ($word, $count) = each %seen ) { > print "$count $word\n"; > } > > The <> is the shorthand mechanism for reading from @ARGV. You don't supply anything in @ARGV. So either populate @ARGV (push the dictionary filename into it), or explicitly open that file and instead of <> use <DICT>. > Plus the fact the same perlfaq6 states this kind of processing is highly > inefficient and suggests using something like the following: [ Code snipped ] > Of which I can only say I seem to have found the chasm across which my > logic will not leap - any pointers to web pages, documentation , or just > plain explanations would be gratefully received Well, the perlfaq suggestion is all well and good if you're running on Unix. The refs to 'xterm' and '/etc/termcap' basically indicate that we won't be using this alternative with MacPerl. :-) ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org