hennesse has asked for the wisdom of the Perl Monks concerning the following question:
$string =~ s/zero/0/ig; $string =~ s/one/1/ig; $string =~ s/two/2/ig; $string =~ s/three/3/ig;
This is cool if there are just a few, but not if a lot. Is there a more compact way to do this?
i.e. I need a "trans-word-ilation" operator, similar to the "transliteration" opeerator
Thanks - Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Combining multiple =~ s/
by salva (Canon) on Mar 07, 2021 at 19:05 UTC | |
by Corion (Patriarch) on Mar 07, 2021 at 19:10 UTC | |
by no longer just digit (Beadle) on Mar 10, 2021 at 06:54 UTC | |
by LanX (Saint) on Mar 07, 2021 at 20:44 UTC | |
|
Re: Combining multiple =~ s/
by haukex (Archbishop) on Mar 07, 2021 at 20:24 UTC | |
|
Re: Combining multiple =~ s/
by kcott (Archbishop) on Mar 08, 2021 at 06:45 UTC | |
|
Re: Combining multiple =~ s/
by LanX (Saint) on Mar 07, 2021 at 20:50 UTC | |
|
Re: Combining multiple =~ s/
by rsFalse (Chaplain) on Mar 11, 2021 at 08:28 UTC |