for($i=1;$i<=scalar(@detail);$i++) { print OUT "$detail[$i-1]"; if($i%59==0) { print OUT "\n"; } }