in reply to s/// for \dOO for typos [SOLVED]

Another version that may do what you want.
#!/usr/bin/perl -w use strict; my @test = qw (20o3oo something 02oo-s 2o0o0o-s 2OoOO); foreach my $x (@test) { print "$x becomes "; $x =~ s|(\d[\doO]+)|my $a = $1; $a=~tr/oO/00/; $a|e; print "$x\n"; } __END__ 20o3oo becomes 200300 something becomes something 02oo-s becomes 0200-s 2o0o0o-s becomes 200000-s 2OoOO becomes 20000
Update: I had neglected the captial O.

A few notes that might help OP on how I arrived at this...
Doing a direct substitution of one char for another is a natural job for tr. However, we don't want to just run amok changing all o or O letters to zeroes (something shouldn't become s0mething). The substitute operator allows a regex to specify the character sequence to apply "tr" upon. You might need to modify this with say "page" as an additional qualifier for the match, but maybe not - you could just run this s/// on every line and that would probably be fine. It is completely allowed to have Perl code calculate the thing that is going to be substituted! Very cool. And that is what the |e; option is all about.