in reply to (Golf) Untwist

Update: 108 passing strict and warnings :-)
use strict; while(<DATA>){ chomp; /(\d+)\s+([_a-z.]+)/ or last; my $plaintext = decipher($1, $2); print "$plaintext\n"; } sub decipher { $,=0;($;,$_)=@_;@;{@;{0..27}=('_','a'..'z','.')}=0..27;$;[$;*$,++%@_]= +$;{($;{$_}+$,)%28}for@_=/./g;join'',@; } __DATA__ 5 cs. 101 thqqxw.lui.qswer 3 b_ylxmhzjsys.virpbkr 0

Here is my initial trial at 126 chars. It passes strict and warnings.

sub decipher { my($k,@r,%b,@s)=@_;@s=pop=~/./g;@b{@b{0..27}=('_','a'..'z','.')}=0..27 +;$r[$k*$_%@s]=$b{($b{$s[$_]}+$_)%28}for 0..$#s;join'',@r }
Aziz,,,

Replies are listed 'Best First'.
Re: Re: (Golf) Untwist
by dragonchild (Archbishop) on Aug 16, 2001 at 05:44 UTC
    Taking ideas from both my previous post and abstracts post ... we can get down to 105 quite nicely.
    @b{@b{0..27}=(_,a..z,'.')}=0..27;@s=pop=~/./g;$p[$_[0]*$_%+@s]=$b{($b{ +$s[$_]}+$_)%28}for 0..$#s;join'',@p
    I especially like the way he does the split I was doing. The comparison is quite stunning.
    @e=split//,pop; @e=pop=~/./g;
    It's only two characters, but it takes advantage of a feature I didn't know about.

    The double hash-slice assignment is also quite neat. It saves more characters over what I was doing, but it's not as stunning, in my eyes. *shrugs*

    ++abstracts!!

    Update: Ok, abstracts! *laughs* Let's get below 100. (I'm still trying to figure out why you want to be strict- and warnings-compliant in a golf. To me, it's enough that it runs more than once, if that's what the golf calls for.)

    @;{@;{0..27}=(_,a..z,'.')}=0..27;$,=0;$;[$_[0]*$,++%@s]=$;{($;{$_}+$,) +%28}for@s=pop=~/./g;join'',@;
    99 characters! :)

    I'd like to congratulate abstracts on finding some very neat golfing techniques. :)

    ------
    /me wants to be the brightest bulb in the chandelier!

    Vote paco for President!

      Hello

      When I saw the test script, I thought it was part of this golf to pass strict and warnings. Maybe my bad.

      Aziz,,,