in reply to Matching Text
#!/usr/bin/perl use strict; use warnings; @ARGV > 0 or die "Insufficient arguments: Need word file, and Dict fil +e names"; my ($wordfile, $dictfile) = @ARGV; open my $d, "<", $dictfile or die "Cannot open $dictfile: $!"; open my $w, "<", $wordfile or die "Cannot open $wordfile: $!"; my %dict = map {split /\s/,$_,2} <$d>; close $d; while (defined (my $line=<$w>)){ for (split /\s/,$line){ if (my $meaning = $dict{$_}){ print "$_: $meaning\n"; next; } print "$_ is not in the dictionary\n"; } } close $w;
All great truths begin as blasphemies.
― George Bernard Shaw, writer, Nobel laureate (1856-1950)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Matching Text
by jwkrahn (Abbot) on Apr 03, 2012 at 05:11 UTC | |
by NetWallah (Canon) on Apr 03, 2012 at 05:23 UTC | |
by Chad C (Initiate) on Apr 03, 2012 at 16:22 UTC | |
|
Re^2: Matching Text
by Chad C (Initiate) on Apr 09, 2012 at 23:09 UTC | |
by Chad C (Initiate) on Apr 10, 2012 at 19:28 UTC |