in reply to How to execute the perl program on different files in the same directory

Here is a little demonstration of the loop and file actions you need.
for my $input_file (glob '*.txt') { (my $output_file = $input_file) =~ s/txt$/output/; open FILE, '<', $input_file or die "$!: $input_file\n"; # process input close FILE; open FILE, '>', $output_file or die "$!: $output_file\n"; # process output close FILE; }

Caution: Contents may have been coded under pressure.
  • Comment on Re: How to execute the perl program on different files in the same directory
  • Download Code