in reply to Pick up specific file name
By changing the regular expression (perlretut):
if ($item =~ /_0828900840_.*D602BG/)
Or, by using a different glob pattern (Update: However, choroba makes a good point about glob, and I should note that I don't usually use it because of several caveats):
my @contents = <$folder/*_0828900840_*D602BG>;
Or by using a module like File::Find::Rule:
use File::Find::Rule qw/rule/; my @files = rule->file->name(qr/_0828900840_.*D602BG/) ->maxdepth(1)->in(@folders);
Update: Upon further consideration, I'm withdrawing my suggestion for glob. As soon as $folder contains whitespace, such as a forgotten chomp, it will break in strange ways. Update 2: It's possible to say use File::Glob ':bsd_glob'; to fix that issue, but my position is still "use glob only if you've read all of its documentation, including File::Glob".
|
|---|