develooper Front page | perl.beginners | Postings from March 2002

Re: Can I do this with perl?

Thread Previous
From:
Jon Molin
Date:
March 4, 2002 07:15
Subject:
Re: Can I do this with perl?
Message ID:
3C838EF5.B74231CD@resfeber.se
Dave Adams wrote:
> 
> Hi there,
> 
> I have a problem which I would like to use perl to resolve, however I'm not
> sure if it is possible to do.
> 
> I need to scan a file and check some conditions, first if field 9 is
> duplicated on 1 or more rows, then I need to check field 10 to see which is
> the greater value and then only print the whole row where field 10 is the
> greater, if field 9 is not a duplicate then print the whole row.
> An example of the data is below.
> 
> 28525|U2|4CY0|50|6775.15|2002-02-07|10461|321.43|102040724|102040773|
> 28526|U2|4CY0|25|3571.78|2002-02-07|6107|167.74|102040774|102040798|
> 28527|U2|4CY0|50|6930.3|2002-02-07|11376|324.12|102040774|102040823|
> 28528|U2|4CY0|25|4640.28|2002-02-07|4800|217.43|102040824|102040848|
> 28529|U2|4CY0|50|8432.05|2002-02-07|9023|392.03|102040824|102040873|

read about split, arrays and hashes and i bet you'll solve it in an
hour.

perldoc -f splir perlfunc
perldoc perldata


/jon


> 
> Dave

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About