Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Golf: Replacing part of a string with "*"

by explorer (Chaplain)
on Aug 18, 2006 at 15:25 UTC ( #568188=note: print w/ replies, xml ) Need Help??


in reply to Golf: Replacing part of a string with "*"

Maybe a regex:

$string =~ s/^\d{12}/'*' x 12/e; # ************5678


Comment on Re: Golf: Replacing part of a string with "*"
Download Code
Replies are listed 'Best First'.
Re^2: Golf: Replacing part of a string with "*"
by ikegami (Pope) on Aug 18, 2006 at 15:32 UTC
    If the OP wanted to hardcode the length, he could have done
    substr($string,0,-4,'*'x12);

    Much clearer.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://568188]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2015-07-31 06:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (274 votes), past polls