in reply to Unique items in a text file
Use a hash, something like the following code
Edit: fixed missing right-curly.my %erg = (); while(<DATA>) { my @row = split(/,/,$_); ++$erg{$row[3]}; } print $_ . ': ' . $erg{$_} . '<br />' . "\n" foreach (keys %erg); __DATA__ Auto,00883,pw00,DX,4/15/2004,10:12:59,1110046,1 Auto,00883,pw00,FA,4/15/2004,10:15:45,, Magic,006513,pw13,Login,4/15/2004,10:16:23,, Car Wash,006513,pw3h,Not Found,4/15/2004,10:16:57,1232246, Home and Auto,006513,pw6513,DI,4/15/2004,10:17:09,15134346,1 Auto,00883,pw00,FA,4/15/2004,10:17:17,, Home,006513,pw6513,Login,4/15/2004,10:17:38,, Home,006513,pw6513,DI,4/15/2004,10:17:44,151234326,1 Deal Time,006513,pw001,Login,4/15/2004,10:53:31,1, Car Wash,006513,pw3h,DI,4/15/2004,10:53:46,11238748,1 Magic,006513,pw13,Login,4/15/2004,11:01:25,0,
regards,
tomte
An intellectual is someone whose mind watches itself.
-- Albert Camus
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Unique items in a text file
by Anonymous Monk on Apr 20, 2004 at 14:34 UTC | |
by Tomte (Priest) on Apr 20, 2004 at 14:38 UTC | |
by Anonymous Monk on Apr 20, 2004 at 15:29 UTC | |
by Anonymous Monk on Apr 20, 2004 at 15:30 UTC | |
by Anonymous Monk on Apr 20, 2004 at 14:45 UTC | |
by Tomte (Priest) on Apr 20, 2004 at 14:57 UTC | |
by Anonymous Monk on Apr 20, 2004 at 14:46 UTC |