in reply to Self-Looping over hash - how to remove duplicate
Probably the easiest way to do this would be to change the following line:
to something along the lines of:$spair{$si."-".$sn} = $prod;
if ((! defined($spair{$si."-".$sn})) and (! defined($spair{$sn."-".$si}))) { $spair{$si."-".$sn} = $prod; }
This will only add the entry for $si."-".$sn if there is no entry currently in %spair for either $si."-".$sn nor $sn."-".$si.
Hope that helps.
|
|---|