Re: a regex question ..



Hi

Fabian Pilkowski wrote:
Yes, it isn't. Try to use s/// instead.

    my $name = 'aaa2bbb3';
    ( my $newname = $name ) =~ s/(\d)/0$1/g;
    # results in: $newname = 'aaa02bbb03'

Just keep in mind that this will change 'aaa11bbb12' to 'aaa0101bbb0102' which is probably not what the OP wants. But right now i can't think of a solution myself...



Be aware of the /g-modifier at the end of s///. Read `perldoc perlop` to
learn more about this substitution operator.
regards,
fabian

Elvis


-- Elvis Cehajic http://www.nihil.ch

perl -e '$_="(o_\n//\\\x0AV_/_\x20\u\x6C\x69\x6E\x75\x78\n";print'
.