in reply to Reading specific files from a directory
First stab:
for my $file ( glob( "$somedir/example*.txt" ) ) {But if you also have files like "examplebroken.txt", then you'll find too many. So you can refine that. I'll assume you have things like "example3.3.1.2.txt" but not "example-2.45e11.txt":
for my $file ( grep m#/example(\d+\.)+txt$#, glob( "$somedir/example*.txt" ) ) {
But I'd stick with your code if you are on an old version of Perl where glob is the sucking death (that is, where it calls /bin/csh to do its work).
If you are using leading-edge Perl, then you can use File::Spec instead of blithely pasting $somedir and exmample*.txt together with a "/".
- tye (but my friends call me "Tye")
|
|---|