in reply to trouble matching
NOTE: Code not tested
#!/usr/bin/perl -w my %lookup = (); # Construct the lookup table while (<INFO>) { chomp; my @list = split; # assuming space separated $lookup{$list[0]} = $list[1]; # search => replace } # Go through the search file and check for lookup strings using # the hash and replace it with the hash-value while (<SRCHFILE>) { for my $k (keys %lookup) { s/$k/$lookup{$k}/g; } print; }
Picking a keyword from a file and then searching for it in the other file and re-reading them it very inefficient. If the first file is manageable i would use a hash as in above example
|
|---|