On Wed, 11 Jul 2001, Fernando wrote:

> I have a credit card number that I want to change to email a reciept to the 
>customer. This is that I want:
>
> I have this number: e.j. 1111 8578 596 8552
> I want to convert all the number to "x" like that xxxx xxx xxxx
>
> when I use this:
>
> $number = "1111 8578 596 8552";
> $number =~ s/\d+/x/g;

You probably should use the tr/// operator, as it is more suited for doing
one to one mapping of characters than substitutions:

my $num = "1111 8578 596 8552";

$num =~ tr/[0-9]/x/;

print "$num\n";

-- Brett
                                   http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
                     *** NEWSFLASH ***

Russian tanks steamrolling through New Jersey!!!!  Details at eleven!

Reply via email to