Where are you intitlizing $all_directories?
push @sourcefiles, $_ if -f and /\.htm*/ ;That regex is safer (and possibly faster) if you wrote it as /\.html?\z/. As written, it will match ".htmmmmm" and even ".ht", which I don't think is what you want. The '*' matches the last character zero or more times (in your case, 'm'). I think what you meant to use was /\.htm.*/, which says "match '.htm' and then any character zero or more times". But even that isn't as good as the one suggested above.
In the suggested regex (/\.html?\z/), we are using the '?' modifier (which says "match the last character zero or one times") to make the 'l' optional. The '\z' anchors the match to the end of the string (so it won't match 'file.htm.txt', for instance).
----
Reinvent a rounder wheel.
Note: All code is untested, unless otherwise stated
In reply to Re: rename files dynamically
by hardburn
in thread rename files dynamically
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |