word mangler

  • August 25, 2012
  • Perl

a little pointless really but fun nevertheless!

the old “can you read this?” chesnut. we can still read even though the characters of each word are mixed up, as long at the first and last letters are in the right place, we can read…

create a file called inputfile and add your text, then run this rather marvelous perl one liner, you will end up with outputfile – containing your jumbled text.

[code language=”perl”]
perl -pe ‘s{(?<=\W\w)(\w\w+)(?=\w\W)}{ my $s; $s= rand(100) > 50 ? qq|$s$_| : qq|$_$s| for (split //, $1); $s; }eg;’ < inputfile > outputfile
[/code]




No Comments


No comments yet.



Leave a Reply

Your email address will not be published. Required fields are marked *