in reply to Adding gaps to a sequence

For amusement/golf purposes only...
sub gapify { join'-',shift=~/@{[map"(.{$_})",@_]}(.*)/x }
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print

Replies are listed 'Best First'.
Re: MeowChow Golf challenge -- Adding gaps to a sequence
by larryk (Friar) on Jul 16, 2001 at 15:50 UTC
    I probably missed a trick or two but here goes nothing at 39 chars
    sub gapify_lk { $s=shift;$s=~s/(.*-)?.{$_}/$&-/for@_;$s }

    "Argument is futile - you will be ignorralated!"