John Fitzgerald wrote: > > --- Rob Dixon <[EMAIL PROTECTED]> wrote: > > > > John Fitzgerald wrote: > > > > > > Hi, I'm fairly new to Perl, and trying to do a > > simple > > > operation on a text file exported from excel. > > > ID Enrolled Extraneous Columns.... > > > 3008 05-Aug-03 > > > 3008 05-Aug-03 > > > 3008 05-Aug-03 > > > 3008 05-Aug-03 > > > 3008 24-Sep-03 > > > 3009 11-Aug-03 > > > 3010 19-Nov-03 > > > 3010 11-Jul-03 > > > 3010 11-Jul-03 > > > 3010 11-Jul-03 > > > 3011 15-Jul-03 > > > > > > As you can see, the dates for a given ID are > > > different. What I need to do, is set the dates all > > > to the earliest date for that ID (client-birth date). > > > The other columns are are important, but don't factor > > > in here. > > > > First, you need to decide what the output is to be. > > Do you > > just want a list like: > > > > 3008 01-Jan-1970 > > 3009 01-Jan-1970 > > 3010 01-Jan-1970 > > 3011 01-Jan-1970 > > > > with each date set to the earliest found? Or do you > > also need > > the 'Extraneous Columns'? > > > > Second: do you have a copy of Date::Calc installed? > > > > perldoc Date::Calc > > > > will tell you if you don't know. > > > > Then you need to know how to use hashes. But let us > > know > > the other stuff first :) > > Thanks for the reply, I don't have date::calc but I > can CPAN it right now. > I need a list set like this: > ID date > 3008 11/1/03 > 3008 11/1/03 > 3008 11/1/03 > 3010 12/1/03 > 3010 12/1/03 > > So I need repeating ID's, with the earliest date for > each ID. If the order of the data is preserved, I can > use just those two columns for processing, then > combine them back with the other columns afterward.
Yep, that makes sense. I started writing an example but the clumsiest part is converting the date format so I need to be sure: - Do you really want m/d/yy with no leading zeroes but with part-century years as two digits? - Your output data doesn't match your input data. Could you post an example pair of I/O record sets? We'll get there, but learn that about 60% of the problem is defining what you want, and 30% is understanding the software already available. Then you write it. Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>