... open FILE, "<$ARGV[0]"; @data_records=; for ($x=0;$x<@data_records;$x++){ for ($index=$x; $index<($x+5);$index++){ @record=split(/\s+/, $data_records[$index]); for($index=1;$index<@record;$index++){ $max[$index]=$record[$index] if $max[$index]<$record[$index]; } } print "$ARGV[0]-",$ARGV[0]+5,"@max\n"; }