$uniques{"$2.cfm"}++;
Increments the value stored under hash key "$2.cfm". If you haven't set it to anything, it'll end up with a value of 1 (0 + 1 = 1) :)
You then set the value of hash key "$2" to '<cust>'.
In your modified version, the line:
Is redundant, since you're overwriting the value on the next line. I think you're looking for something like this:$uniques{"$2"}++;
while ($_ =~ /(<cf_)(.*?)[>\s]/gi) { # finding custom tags $uniques{$2}++; }
Then you can print out a list of how many times each custom tag is being called with something like this:
Or, do whatever else you want with the results...while (my ($code, $count) = each %uniques) { print "$code => $count\n"; }
In reply to Re: Two hash keys created when '.' is in the string
by Mutant
in thread Two hash keys created when '.' is in the string
by yacoubean
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |