Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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

by explorer (Chaplain)
on Aug 18, 2006 at 15:25 UTC ( [id://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 (Patriarch) 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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://568188]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-25 14:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found