David wrote:
>
> Joseph Paish wrote:
>
> > i have a data file that looks something like this :
> > ( it is already sorted by date )
> >
> > 12/22/02 abc 123 456 789
> > 12/23/02 def 246 812 98234
> > 12/24/02 ank 987 23456 8762
> > 12/27/02 abc 987 345 65434
> > 01/05/03 abc 876 2356 87
> > 01/09
Joseph Paish wrote:
> i have a data file that looks something like this :
> ( it is already sorted by date )
>
> 12/22/02 abc 123 456 789
> 12/23/02 def 246 812 98234
> 12/24/02 ank 987 23456 8762
> 12/27/02 abc 987 345 65434
> 01/05/03 abc 876 2356 87
> 01/09/03 ank 875 234 98098
> 02/01/03 def
That makes me happy. :)
split() was my first thought, but I wanted to keep it simple for the
example(for once), and thought it might actually be faster.
Personally, though, I'd *definitely* use the split()!
--- "NYIMI Jose (BMB)" <[EMAIL PROTECTED]> wrote:
> > my $prevrec = <>;
> > my $key =
> my $prevrec = <>;
> my $key = substr($prevrec,9,3);
I'd be using split here to avoid hard-coding the string's length
my $key=( split(/\s+/,$prevrec) )[1];
> while(<>) {
> my $tmp = substr($_,9,3);
The same here ...
my $tmp=( split/\s+/ )[1];
> next if $key eq $tmp;
> print $
--- Joseph Paish <[EMAIL PROTECTED]> wrote:
> i have a data file that looks something like this :
> ( it is already sorted by date )
> 12/22/02 abc 123 456 789
> 12/23/02 def 246 812 98234
> 12/24/02 ank 987 23456 8762
> 12/27/02 abc 987 345 65434
> 01/05/03 abc 876 2356 87
> 01/09/03 ank 875 234
Joseph Paish wrote:
> i have a data file that looks something like this :
> ( it is already sorted by date )
>
> 12/22/02 abc 123 456 789
> 12/23/02 def 246 812 98234
> 12/24/02 ank 987 23456 8762
> 12/27/02 abc 987 345 65434
> 01/05/03 abc 876 2356 87
> 01/09/03 ank 875 234 98098
> 02/01/03 def 9
i have a data file that looks something like this :
( it is already sorted by date )
12/22/02 abc 123 456 789
12/23/02 def 246 812 98234
12/24/02 ank 987 23456 8762
12/27/02 abc 987 345 65434
01/05/03 abc 876 2356 87
01/09/03 ank 875 234 98098
02/01/03 def 987 3453 456
02/05/03 ghi.th 987 2345 94