Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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

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 about the Monastery: (7)
As of 2016-09-30 07:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (562 votes). Check out past polls.