@REM=(" @c:\bin\perl.exe c:\bin\%0.BAT %1 %2 %3 %4 %5 %6 %7 %8 %9 @goto end ") if 0; # This is where the perl program goes # initialize if (!@ARGV) { die "\n$0: Usage: $0 [] [..]\n"; } open(PAIRS,") { s/\n//; ($a,$b) = split(/\s*:\s*/,$_); $b =~ s/,/\\,/; $testarr{$a} = $b; } foreach $file (@ARGV) { if (!-e $file) { print STDERR "File $file not found\n"; } else { ($fname, $type) = ($file =~ /^([^.]+)\.?(.*)$/); push(@INFILES, $file); push(@INNAMES, $fname); } } print STDERR "@INFILES\n"; $/ = ''; foreach $file (@INFILES) { $fname = shift @INNAMES; open (FILE,"<$file") || die "Can't open $file $!\n"; print STDOUT "\nReading input file: $file\n"; open (OUTPUT,">$fname.fix") || die "Can't open output file $fname.fix\n"; select(STDOUT); while (){ foreach $test (keys(%testarr)){ $sub += s/$test/$testarr{$test}/ige; } print OUTPUT "$_"; } print STDERR "---- $fname.fix had $sub substitutions made.\n"; $sub = 0; close(OUTPUT); } @REM=(" :end ") if 0;