turn garble into anagram
parent
62dc7d1fa9
commit
469c2505a1
|
@ -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
|
Loading…
Reference in New Issue