use strict;
use warnings;
use File::Basename;
# Declare package names
my $work_file;
my $out_file;
my @files = <E:\\triggers\\1_MERGE_3326\\tests\\*.hl7>;
#$work_file = pop; # If work_file comes from command line, uncomment
my $inPath = "E:\\triggers\\1_MERGE_3326\\pass";
my $outPath = "E:\\triggers\\1_MERGE_3326\\converted";
foreach $work_file (@files) {
print "$work_file\n";
open (WORK, "<$work_file") or die "Couldn't open $work_file."; # Open
+the working file
my $outFile = basename($work_file);
print "$outFile\n";
open (OUT, ">$outPath\\$outFile") or die "Couldn't open $outPath\\$out
+File."; # open an output file
while (<WORK>) {
chomp;
$_ =~ tr/\000-\011\013\014\016-\037//d;
print OUT map {"$_\n"} ($_);
} # end while
close WORK;
close $work_file;
} # end foreac
|