Thanks.my %hash=(); %hash=( ##keys between "" because of dots "M01.001" =>["M01.001"]' "M01.001.111" =>["M01.001.111"]' "M01.001.111.111" =>["M01.001.111.111"]' "M01.002" =>["M01.002"]' "M01.002.003" =>["M01.002.003"]' ) for my $k(sort keys %hash){ my $temp = reverse($k); $temp =~ s/^\d{3}\.?//; my $t= reverse ($temp); if (exists $hash{$t}){ $hash{$k}[1] += 1; } }
Edit: Fixed array brackets in text para. davorg
In reply to Incrementing a hash of array value by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |