in reply to Re^2: Fun with words (Golf?)
in thread Fun with words (Golf?)

Look Ma, no modules!

perl -pe's!\B\w+\B!@s=split//,$&;my$s;$s.=splice@s,rand@s,1while@s;$s! +eg'
Three chars for List::Util is a good trade, I think... :-)

-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re^4: Fun with words (Golf?)
by Roy Johnson (Monsignor) on Nov 09, 2005 at 20:57 UTC
    An alternative to split trims two of those chars.
    perl -pe's!\B\w+\B!@s=$&=~/./g;my$s;$s.=splice@s,rand@s,1while@s;$s!eg +'

    Caution: Contents may have been coded under pressure.
      And trim 6 chars off the rival:
      perl -MList::Util=/./ -pe's:\B\w+\B:join"",shuffle $&=~/./g:ge'
      (update: changed this from using split too; thanks Roy_Johnson)