in reply to Reg Expression on file name
The T* part of that restricts the match to files beginning with "AB DA" followed by 0 or more T's followed by ".doc" and that's probably not what you meant. You are missing a dot. Try /^AB DAT.*\.doc$/i instead. Note that I replace the \s with a literal space. That's because \s will also match a tab or a newline.
I don't know if you really want the /i modifier. That will make the expression case insensitive so it will also match files beginning with "ab dat" or "Ab DaT" and so on.
You might also consider using unless rather than if ... !~ too. I'd write the whole thing as
next unless $file =~ /^AB DAT.*\.doc$/;
By the way, filenames with spaces in them are yucky. If you have control over the filenames, I suggest renaming them and replacing spaces with underscores.
-sauoq "My two cents aren't worth a dime.";
|
|---|