read/parse the json outside the trigger block
parent
bec9546041
commit
e867420f34
|
@ -8,11 +8,6 @@ zci is_cached => 1;
|
||||||
|
|
||||||
triggers start => "find anagrams";
|
triggers start => "find anagrams";
|
||||||
|
|
||||||
handle remainder => sub {
|
|
||||||
|
|
||||||
if ($_ eq ""){
|
|
||||||
return "No Anagrams Found."
|
|
||||||
}
|
|
||||||
|
|
||||||
my $json = scalar share('words.json')->slurp;
|
my $json = scalar share('words.json')->slurp;
|
||||||
|
|
||||||
|
@ -20,6 +15,13 @@ handle remainder => sub {
|
||||||
|
|
||||||
#print Dumper(\%wordHash);
|
#print Dumper(\%wordHash);
|
||||||
|
|
||||||
|
|
||||||
|
handle remainder => sub {
|
||||||
|
|
||||||
|
if ($_ eq ""){
|
||||||
|
return "No Anagrams Found."
|
||||||
|
}
|
||||||
|
|
||||||
# Format string to look like hash key by making it lowercase then splitting the string into chars, sort them and finally join back into sorted string
|
# Format string to look like hash key by making it lowercase then splitting the string into chars, sort them and finally join back into sorted string
|
||||||
my $sorted_string = join("",sort(split(//,lc($_))));
|
my $sorted_string = join("",sort(split(//,lc($_))));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue