in reply to PPGA - Prolog-Perl Golf Association: Run-length encoding

Here's another golfed Perl solution, at 67 characters:
sub rle { ($c)=@_;my$i;map$c ne$_?("$i*$c",$i=1,$c=$_)[0]:++$i&&(),@_,!$_[-1] }

Replies are listed 'Best First'.
Re: Re: PPGA - Prolog-Perl Golf Association: Run-length encoding
by mikeB (Friar) on Jul 02, 2001 at 21:14 UTC
    Hmm... this appears signigicantly shorter than the original Prolog. Looks like it's PrincePawn's turn to take a swing at the ball :)

    Just goes to show what a flexible language Perl is.

    TMTOWTSAC!