http://qs321.pair.com?node_id=740272


in reply to Re: Drunken words
in thread Drunken words

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 ;