use strict; use warnings; my @insert1 = qw(1 1 1); my @insert2 = qw(2 2 2); my @inserts = (\@insert1, \@insert2); my $outfile = 'delme.txt'; my $ins = 0; open OUTFILE, '>', $outfile; print OUTFILE <; } ... #### insert called:0 first second third 1 1 2 3 1 x y z 1 insert called:1 first second third 1 2 1 2 3 1 2 x y z 1 2