Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Incrementing a hash of array value
by beable (Friar) on Jul 23, 2004 at 10:58 UTC | |
by Anonymous Monk on Jul 23, 2004 at 21:28 UTC | |
|
Re: Incrementing a hash of array value
by davorg (Chancellor) on Jul 23, 2004 at 10:55 UTC | |
|
Re: Incrementing a hash of array value
by EdwardG (Vicar) on Jul 23, 2004 at 10:53 UTC | |
by davorg (Chancellor) on Jul 23, 2004 at 10:59 UTC | |
by EdwardG (Vicar) on Jul 23, 2004 at 11:06 UTC | |
by davorg (Chancellor) on Jul 23, 2004 at 11:09 UTC | |
by EdwardG (Vicar) on Jul 23, 2004 at 11:11 UTC | |
|
Re: Incrementing a hash of array value
by wfsp (Abbot) on Jul 24, 2004 at 08:06 UTC | |
by Raad (Acolyte) on Jul 26, 2004 at 13:35 UTC | |
by wfsp (Abbot) on Jul 26, 2004 at 14:40 UTC |