in reply to Batch processing files in a directory
Here's another option:
use strict; use warnings; for my $file (<*.ptseq>) { my ($baseName) = $file =~ /^(.+)\.[^.]+$/; my $textFile1 = $baseName . '1.txt'; my $textFile2 = $baseName . '2.txt'; print "$file ->\t$textFile1\t$textFile2", "\n"; }
Output from my dir:
fileA.ptseq -> fileA1.txt fileA2.txt fileB.ptseq -> fileB1.txt fileB2.txt fileC.ptseq -> fileC1.txt fileC2.txt fileD.ptseq -> fileD1.txt fileD2.txt
In Section
Seekers of Perl Wisdom