On Thursday, Mar 20, 2003, at 14:23 US/Pacific, David Gilden wrote: [..]
I am trying to get the following as a result:
xxxxxxx9988

#!/usr/bin/perl -w

$card_number = '123456789988';

$card_number =~ s/\d{8}(\d{4})/x'x'8 . $1/e; # not working....

print "$card_number\n";

I presume when you run that you get something like


Line 10: String found where operator expected within string

why not try the simpler fix

$card_number =~ s/.*(\d{4})/xxxxxxx$1/;

unless you actually care that the first 8 elements
have to be numeric.... Which if you did, you would
of course want to nest this in the appropriate conditional
so that you handle the case

my $card_number = '12345678a9988';

as being BROKEN INPUT.


ciao drieux

---


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to