Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Golf: New spellings for old names

by Sprad (Hermit)
on Nov 21, 2003 at 16:05 UTC ( [id://308931]=perlmeditation: print w/replies, xml ) Need Help??

After seeing the name "Shanyn", I came up with this idea. Lots of names that have been around for years are suddenly being jazzed up with funky spellings. But it's hard to figure out the right way to (mis)spell a name. So why not turn to Perl?

Below are my rules for getting the Hip New Spelling for a name. I'll use a conveniently-named monk as an example.

  • Change all double letters to one letter. (tilly -> tily)
  • Change all vowels (aeiou) to y. (tily -> tyly)
  • Change all y's (from the original string) to i. (tyly -> tyli)

Given a name in a scalar $n, convert to the new spelling in as few keystrokes as possible.

---
A fair fight is a sign of poor planning.

Replies are listed 'Best First'.
Re: Golf: New spellings for old names
by Anonymous Monk on Nov 21, 2003 at 16:32 UTC

    Just to get the ball rolling at 32 chars:

    #2345678901234567890123456789012 $n=~y/a-zA-Z//s;$n=~y/yaeiou/iy/

      27:

      y/A-z//s,y/yaeiou/iy/ for$n #2345678 1 2345678 2 234567

                      - tye

        A tie with tye?

        #23456789012345678901234567 $n=~y/yaeiouA-z/iyyyyyA-z/s

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (1)
As of 2024-04-25 02:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found