Chipped a bit off ;)
sub mangle {
(@chars) = split '', shift;
for($i=1;$i<$#chars-1;$i++){
next if(substr(join('',@chars), $i-1, 4) =~ / /);
$buf=$chars[$i],$chars[$i]=$chars[$i+1],$chars[$i+1]=$buf if(rand(
+10)>5);
}
return join '', @chars;
}
EDIT: Never go away for 10 minutes before posting on one of these posts... you will always submit and find 50 better versions than what you wrote before you ;)
This page is intentionally left justified.
janitored by ybiC: Replace <pre> tags around code snippet with <code> tags, as per Monastery convention