Help for this page

Select Code to Download


  1. or download this
    s/(key1|key2|key3)/$hash{$1)/g;
    
  2. or download this
    my $re = join '|', keys %dict;
    $re = qr|($re)|;
    s/$re/$hash{$1}/g;
    
  3. or download this
    use Regexp::Assemble;
    my $ra = Regexp::Assemble->new;
    $ra->add($_) for keys %dict;
    
  4. or download this
    s/(\w+)/$dict{$1}||$1/ge;
    
  5. or download this
    s/(\w+)(?(?{$dict{$1}})|(?!))/$dict{$1}/g;