in reply to how to substiute given key with value by using hash.
my %hash = (...); my $src = do { local $/; <> }; my $res = join '', map $hash{$_} // $_, split /\b/, $src; # %hash = (a => 'xxx') # $src = 'a b ab'; # $res = 'xxx b ab';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |