my @latitude = split(/\./, $_[5]); my $latstring = sprintf("%8s", ($latitude[0] . $latitude[1])) ; #### while () { chomp $_; if ($_[0] eq $lastline ) { if ($_[0] eq "1sec CDMA Event DtiC(0)") { #average those things or whatever you neeed to do }elsif ( $_[0] eq "Generic Scanner PN Measurement DtiC(0)") { #average those things or whatever you need to do } } else { #determine which part of the tuple this line is and #store Rxpower/add Rxpower and massage lat/long into strings } $lastline = $_[[0]; }