develooper Front page | perl.golf | Postings from August 2002

Re: putting practice

Thread Previous | Thread Next
From:
Mtv Europe
Date:
August 30, 2002 03:16
Subject:
Re: putting practice
Message ID:
Xns927A90E1B2A59mtve212166108@64.70.54.95
Hello Greg!

gregallen_golfer@yahoo.com (Greg Allen) wrote: 
> #    (1)  Only letters will be encrypted.
> #    (2)  Words with less than 3 letters will be reversed.
> #    (3)  Words with more than 3 letters will be scrambled this way:
> #           * All letters on even locations move to the left-hand side.
> #           * All letters on odd locations move to the right-hand side.

your sample output (those -> toe'hs) clearly shows opposite direction,
i.e. odds (counting from one) to the left and evens to the right.

> #           * A "`" gets between the both sides if the word has more
> #             than 4 characters.

and naive approach is 68, i believe:

-p s#\pL+#$_=$&;/..../?join'',/(.).?/g,'`'x/.{5}/,/.(.)/g:reverse#eg

---
Mtv Europe

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About