turn garble into anagram

master
yegg 2012-04-15 16:23:55 -04:00
parent 62dc7d1fa9
commit 469c2505a1
1 changed files with 2 additions and 3 deletions

View File

@ -1,13 +1,12 @@
package DDG::Goodie::Garble;
package DDG::Goodie::Anagram;
# ABSTRACT: Take a query and spit it out randomly.
use DDG::Goodie;
use List::Util 'shuffle';
triggers start => "garble";
triggers start => "anagram";
handle remainder => sub {
$_ =~ s/\s//g; #remove spaces
@chars = split(//, $_); #convert each character of the query to an array element
@garbledChars = shuffle(@chars); #randomly reorder the array
$garbledAnswer = join('',@garbledChars); #convert array to string