Ing. Branislav Gerzo wrote:
my $keyword = "business"; my %all2words = (); open TXT, "words.txt" or die $!; while (<TXT>) { chomp;
next unless /\b$keyword\b/; # skip loop if no keyword
while ( /(?=(\S+\s+\S+))\S+/g ) { my $temp = $1; $all2words{$temp}++ if $temp =~ /$keyword/i; } } close TXT or die $!; for my $test ( sort { $all2words{$b} <=> $all2words{$a} } keys %all2words ) { print "$test => $all2words{$test}\n"; }
-- Just my 0.00000002 million dollars worth, --- Shawn "Probability is now one. Any problems that are left are your own." SS Heart of Gold, _The Hitchhiker's Guide to the Galaxy_ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>