in reply to Separating multiple keyword search input
my %replacements = qw/men women houses homes cats dogs venus mars carpet rug full empty/; my $string = "men cats houses venus carpet full"; for my $keyword ( keys %replacements ) { my $re = qr/\b$keyword\b/; $string =~ s/$re/$replacements{$keyword}/gi; } print "$string\n"; __OUTPUT__ women dogs homes mars rugs empty
Hope this helps. There are other similar idioms, and other different idioms that accomplish the same thing, but this one seems to be more or less what you're asking for.
Dave
|
|---|