hello perl , <nice to meet you >
I am trying to sort a data file on field 3 that looks like: 08/09/04 11:02:43 E00004 08/09/04 11:02:43 E01220 08/09/04 11:02:43 E00820 08/09/04 11:02:43 E01001 08/09/04 11:02:43 E00712 08/09/04 11:02:43 E01281 08/09/04 11:02:43 E00850 Here is my code: <snippett..... snippett> open (FOO, ">$scratches") || die "could not open file:$!"; open (D, "$logf") || die "could not open file:$!"; while (<D>) { ## look for 9840S and ebexpire ## declare OFS = tab ## tell split to split on IRS 0,1&5. very similar to awk print $ if (($_ =~ /9840S/) && ($_ =~ /ebexpire, ebexpire/ )) { local $, = "\t"; print FOO +(split)[0,1,5], $/; #print FOO (sort { $a <=> $b } $_ ); } } close (FOO); close (D); My question is how do I combine the two print FOO statements so that I am still splitting fields 0,1,5 while sorting on field 5, or the Estrings? thanks, derek