use strict; my $z = 1; for (my $d=1; $d < 10; $d++) { if ($z==1) { print $headers, "\n"; $z=0; } else { print $body, "\n"; $z=1; } }