Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: A little golfing challenge: replace digits by random letters (updated) -- oneliner

by Eily (Monsignor)
on Feb 10, 2019 at 20:24 UTC ( [id://1229740]=note: print w/replies, xml ) Need Help??


in reply to Re: A little golfing challenge: replace digits by random letters (updated) -- oneliner
in thread A little golfing challenge: replace digits by random letters

That's already impressive, but why bother with chr in the first place? perl '-M0;@h{+a..z}=1'-pe 's/\d/(keys%h)[$&]/eg' input.txt works just as fine.

Edit: this can still be reduced a little:

perl '-M0;@h{a..z}=1'-pe 's/\d/(%h)[$&*2]/eg' input.txt

  • Comment on Re^2: A little golfing challenge: replace digits by random letters (updated) -- oneliner
  • Select or Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2024-04-19 01:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found