undisputed has asked for the wisdom of the Perl Monks concerning the following question:
'555549' => [ '172193', '19601', '19602', '3252', '3665', '8959', '4758', '14835', '16718' ], '560834' => [ '172193', '19601', '19602', '3252', '3665', '8959', '4758', '14835', '16718' ],
There are more though. So i will like to be able to read the first 2 key values in the hash, compare them(this i know how to) then insert the difference somewhere(i know how). Then take the 3rd key(present) and compare with the 2nd one(previous).Do the same until the whole keys have been iterated through. So its just pick previous and present,do my thing, move to next etc. The truth is, i don't know how to access each key the way i explained in style of previous/present. Any algorithms,tips,answers will be useful.</code>
This is how i populated the %hash:
my %result; while ( my $rec = $data->fetchrow_hashref ) { push @{ $result{ $rec->{"ID"} } }, $rec->{"item"}; }
|
|---|