Home: Fun With Perl: Perl Golf:
Rearrangement [GOLF]



unknownSym
stranger

Feb 16, 2002, 10:30 AM


Views: 57878
Rearrangement [GOLF]

Who can come up with the shortest solution to change

Code
.comeads-thramergossaph@to:jmail

into

Code
mailto:japh@gossamer-threads.com

There best score is 39. That solution is at http://gossamer-threads.com/jobs/index.htm.


Paul
Enthusiast

Feb 16, 2002, 10:40 AM


Views: 57877
Re: [unknownSym] Rearrangement [GOLF]

I take it you don't know Jason (assuming it was him that wrote it) :)

No-one beats his code.

But how about:


Code
s/(.{4})(.{4})/$2$1/g+s/(.{8})(.{8})(.{8})(.{8})/$4$3$2$1/;



(This post was edited by RedRum on Feb 16, 2002, 10:48 AM)


mhx
Enthusiast / Moderator

Feb 16, 2002, 4:46 PM


Views: 57863
Re: [RedRum] Rearrangement [GOLF]


Code
$_=join'',reverse/(.{4})/g

-- mhx

At last with an effort he spoke, and wondered to hear his own words, as if some other will was using his small voice. "I will take the Ring," he said, "though I do not know the way."

-- Frodo



yapp
User

Feb 17, 2002, 1:58 AM


Views: 57858
Re: [mhx] Rearrangement [GOLF]

Whuaaah! Cool very cool. That really beats the best score! PirateSmile nice.

Yet Another Perl Programmer

_________________________________
~~> [url=http://www.codingdomain.com]www.codingdomain.com <~~
More then 3500 X-Forum [url=http://www.codingdomain.com/cgi-perl/downloads/x-forum]Downloads! Cool


Paul
Enthusiast

Feb 17, 2002, 2:56 AM


Views: 57853
Re: [mhx] Rearrangement [GOLF]

Mmmm you got lucky :)


unknownSym
stranger

Feb 18, 2002, 5:45 AM


Views: 57841
Re: [mhx] Rearrangement [GOLF]

Very nice. Good job.