in reply to (golf) Interlaced Strings


Strange. Nobody used bitwise or. The following is 41 chars:
sub R1{ $_=sub{join"\0",split//,pop};"\0".&$_|&$_ }

This is 37 chars but would clobber a subroutine called "_":
sub R2{ sub _{join"\0",split//,pop}"\0".&_|&_ }

This is 33 chars but doesn't preserve case:
sub R3{ sub _{join$",split//,pop}$".&_|&_ }


John.
--

Replies are listed 'Best First'.
Re: Re: (golf) Interlaced Strings
by MeowChow (Vicar) on May 02, 2001 at 23:09 UTC
    Nice. You can save 2 chars on these by replacing:
    split//,pop
    with
    pop=~/./g # or just 1 char if you put in the 's' modifier
       MeowChow                                   
                   s aamecha.s a..a\u$&owag.print