I guess th error was "it doesn't work" ;-) 1
The '*' in regular expressions is a quantifier (0 or more) for whatever stood before it. It's not like '*' in shell globbing, where it stands for any number of characters.
next unless $file =~ m/^ AB \s DAT .* \.doc $/x;
A regexp is overhead here, because you only check for constant strings: 'AB DAT' (that space is probaly not going to be a newline or tab someday) and '.doc', so it's more effective to say:
next unless
substr($file,0,6) eq 'AB DAT'
and substr($file,-4) eq '.doc'
;
1 whenever you have a problem, describe what went wrong. In this case now it was clear, but for the future: describe the unwanted behaviour.
--
http://fruiture.de |