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

Re: putting practice

Thread Previous | Thread Next
From:
Mtv Europe
Date:
August 30, 2002 11:59
Subject:
Re: putting practice
Message ID:
20020830185935.30597.qmail@onion.perl.org
Hello Greg!

gregallen_golfer@yahoo.com (Greg Allen) wrote:
> Hurrah: a decoder.. much borrowed, too much added (scores 105).
> 
> #!perl -p
> s#\pL+(`\pL*)?#$_=$&;$1||s/(..)(..)/$1`$2/;/`/?
> ($l=()=/../g)&&join'',/([^`])(?=.{$l}(.)?)/g:reverse#eg

this is more challenging task (albeit not so well-defined since
transformation is not reversable), and here is another solution (92):

-p s#\pL+`?\pL*#join'',@_[(split//,$&)>4?map{$_-
1,$_+@_/2}1..@_/2:@_>3?(0,2,1,3):(2,1,0)]#eg

>> > #    (2)  Words with less than 3 letters will be reversed.

that must be readed as "less or equal" for clarity

---
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