I am trying to capture my matches of non-ascii characters from the string field into a hash to count each of those matches. The list of all character matches from a single run through the inner loop (a single row of the table) is to be the value of another hash keyed on $descid. Finally, $conid is to be the key to a hash whose value is the list of $descid in the table as a whole.
In other words, I want an inner hash counting character matches, a list of hashes, a hash of lists keyed on $descid, and a hash of hashes keyed on $conid
I can capture the characters in the code shown. How do I capture the list of characters matched from a single row of the table to put them into an annonymous array to become the value of the outer hash? I have looked through the camel, the lol tutorial, and other places, but I don't see the answer. I tried making the inner loop:
thinking that capturing the matches in list context would do it, but it didn't.while(@rowmatches = /[^\x{1}-\x{7f}]/go){ ...
my %chars; # my $descid; # my $conid; while (<>) { while (/[^\x{1}-\x{7f}]/go){ ++$chars{$&}; } } foreach my $char (keys %chars){ print "$char found $chars{$char} times\n"; } print "found ". keys(%chars) . " distinct non-ascii chars\n";
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |