singhabsk 0 Newbie Poster

Good morning all,
here i have some probs. in logic if possible just solved it
i have a text file contains following data.....

sec   TID    SID    ATTRIBUTE
69013 1-3039 1      REGISTER
69013 1-3039 1       100
69013 1-3039 1       401
69013 1-3039 2      REGISTER
69013 1-3039 2      100
69013 2-3039 1      REGISTER
69013 3-3039 1      REGISTER
69013 4-3039 1      REGISTER
69013 1-3039 2       200
69013 2-3039 1       100
69013 2-3039 1       401
..................
..................
69023 193-3039 2     100
69023 193-3039 2     401
69023 222-3039 1    REGISTER
69023 177-3039 2    100
69024 177-3039 2    401
69024 214-3039 1    100
69024 214-3039 1    401
69024 214-3039 2    REGISTER
69024 223-3039 1    100
69024 223-3039 1     401
69024 223-3039 2    REGISTER
......................................................................................
For first 10 second records (i.e. from 69013 to 69023) i wanna do some computation with following parameters and again for next 10 sec. and so on....... i want to do same operation.

i wanna no. of count of 401 where 401's and REGISTER's TIDs are same.
i wanna no. of count of 200 where 200's and REGISTER's TIDs are same.
i wanna no. of count of different REGISTER's TIDs. (that is no. of different TIDs ending with 1 (1-3039-1 or 2-3039-1) and ending with two (1-3039-2 or 1-3039-2)).

help me out if u can perl guru............
thanks in adv. 


or else only help how to read all records or lines in 10 second intervel
here is my logic n code 
CODE:
my $flag=0;
my count=0;
Open INPUT or die.........
while<INPUT>
{
my($time,$TID,$SID,$ATTR)=split(/ /,$_,4);
if (flag==0)
      { $count=$time+10;
         $flag=1;
      }
while(<INPUT> && time$<=$count)
{
  my($time,$TID,$SID,$ATTR)=split(/ /,$_,4);
//do stuff;
}
$flag=0;

}

but i m not sure how to read next $_ (next line) of file in second while loop for 10 second........help me out
thankssssssss in adv