in reply to Golf: Replacing part of a string with "*"
my $string= '62880147894644072'; substr( $string, 0, -4 ) =~ tr//*/c; print $string, $/;
Note that I substituted my own credit card number for yours in my test code. ;)
Update: ++ to Sidhekin for out golfing me while I was previewing. ( I like this solution because I find it clear, not because it involves fewer keystrokes. :)
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Golf: Replacing part of a string with "*" (lvalue substr)
by kwaping (Priest) on Aug 18, 2006 at 17:48 UTC |