read/parse the json outside the trigger block
parent
bec9546041
commit
e867420f34
|
@ -8,18 +8,20 @@ zci is_cached => 1;
|
|||
|
||||
triggers start => "find anagrams";
|
||||
|
||||
|
||||
my $json = scalar share('words.json')->slurp;
|
||||
|
||||
my %wordHash = %{decode_json($json)};
|
||||
|
||||
#print Dumper(\%wordHash);
|
||||
|
||||
|
||||
handle remainder => sub {
|
||||
|
||||
if ($_ eq ""){
|
||||
return "No Anagrams Found."
|
||||
}
|
||||
|
||||
my $json = scalar share('words.json')->slurp;
|
||||
|
||||
my %wordHash = %{decode_json($json)};
|
||||
|
||||
#print Dumper(\%wordHash);
|
||||
|
||||
# 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($_))));
|
||||
|
||||
|
|
Loading…
Reference in New Issue