combines final parses txt files:
#!/usr/bin/perl
use strict;
use warnings;
use File::Spec;
# Get the current directory
my $folder_path = File::Spec->rel2abs('.');
# Specify the output file name
my $output_file = 'combined_output.txt';
# Clear the contents of the output file before writing
open(my $clear_fh, '>', $output_file) or die "Cannot open $output_file for writing: $!";
close($clear_fh);
# Open the output file for appending
open(my $out_fh, '>>', $output_file) or die "Cannot open $output_file for appending: $!";
# List of specific files to combine
my @files_to_combine = qw(bizname_semi_values.txt bizname_semi_values_6.txt bizname_semi_values_11.txt );
# Iterate through each specified file, read its content, and append to the output file
foreach my $file (@files_to_combine) {
my $file_path = "$folder_path/$file";
open(my $in_fh, '<', $file_path) or die "Cannot open $file_path for reading: $!";
# Read file content in larger chunks (4KB)
while (my $bytes_read = read($in_fh, my $buffer, 4096)) {
print $out_fh $buffer;
}
close($in_fh);
}
# Close the output file
close($out_fh);
print "Combined specified text files into $output_file\n";