use strict; use warnings; use File::Copy; open (my $dbout_h, '>', "D:\\Projects\\test.txt") || die ("Unable to open/File not exists: $dboutfile\n"); #open file to write print $dbout_h "output - Table:
\n\n"; my @arr =( 1, 2, 3); { local $" = '\n"; #print the results in database output file } } print $dbout_h "<\/table>\n<\/html>"; close ($dbout_h); copy ( "D:\\Projects\\test.txt", "D:\\Projects\\test1.txt"); open (my $dbout1_h, '<', "D:\\Projects\\test1.txt") || die ("Unable to open/File not exists: test1.txt\n"); #open file to write my $file = do {local $/, <$dbout1_h>}; $file =~ s!
'; for (@arr) { next if (!@arr); print $dbout_h "
@arr