Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
So in the example, I need to keep only ID 13 with a date of 11052005 and ID 200 with the date 11012005. Thanks in advance....ID Date 13 10102005 13 09152005 13 11052005 200 11012005 200 11152004 Here's the code I wrote: foreach $data1(@data_241) { @compare1 = split($data1); foreach $data2(@data_241) { @compare2 = split($data2); if ($compare1[0] == $compare2[1]) { if ($compare1[1] > $compare2[2]) { print NEW "@compare1"; } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Comparing rows keeping latest
by Grygonos (Chaplain) on Feb 20, 2006 at 20:44 UTC | |
by Anonymous Monk on Feb 20, 2006 at 20:53 UTC | |
by Grygonos (Chaplain) on Feb 21, 2006 at 18:02 UTC | |
|
Re: Comparing rows keeping latest
by GrandFather (Saint) on Feb 20, 2006 at 20:23 UTC | |
by Anonymous Monk on Feb 20, 2006 at 20:27 UTC | |
|
Re: Comparing rows keeping latest
by neilwatson (Priest) on Feb 20, 2006 at 20:02 UTC | |
by Anonymous Monk on Feb 20, 2006 at 20:11 UTC | |
by neilwatson (Priest) on Feb 20, 2006 at 20:37 UTC | |
|
Re: Comparing rows keeping latest
by CountOrlok (Friar) on Feb 20, 2006 at 20:34 UTC |