Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
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
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 exploiting the Monastery: (4)
As of 2014-07-26 01:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls