in reply to Drunken words

Waht deos bteter mean hree ? Atneohr solotiun :

#!/usr/bin/perl -w use strict; use List::Util qw(shuffle); s<^(\w?)(.+?)(\w?)$><print+(join('',$1,shuffle(split//,$2),$3,' '))>e +for @ARGV; print "\n";

Replies are listed 'Best First'.
Re^2: Drunken words
by andye (Curate) on Jan 30, 2009 at 18:54 UTC
    or

    #!/usr/bin/perl -w use strict; use List::Util qw(shuffle); print map { join '', $_->[0], shuffle(@{$_}[1 .. $#$_-1]), $_->[$#$_], + ' ' } map { [ split // ] } @ARGV ;

    although that doesn't really work for 1-letter words

    update

    #!/usr/bin/perl -w use strict; use List::Util qw(shuffle); print map { !$#$_ ? $_->[0].' ' : join '', $_->[0], shuffle(@{$_}[1 .. + $#$_-1]), $_->[$#$_], ' ' } map { [ split // ] } @ARGV ;