in reply to Re^2: finding a file exist amongst many files
in thread UPDATE :: finding a file exist amongst many files
Take two, with builtins only. Note that with readdir, it doesn't keep the whole path, so you have to add it back manually:
use warnings; use strict; my $dir = 'test'; opendir my $dh, $dir or die $!; while (readdir $dh){ if (/tpsm_.*/ && -f "$dir/$_"){ print "$dir/$_ is a file\n"; } }
update: or use glob as Corion said :)
|
|---|