in reply to rename files dynamically
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: rename files dynamically
by Anonymous Monk on Feb 24, 2003 at 16:39 UTC | |
by hardburn (Abbot) on Feb 24, 2003 at 16:53 UTC | |
by Anonymous Monk on Feb 24, 2003 at 18:11 UTC | |
by pfaut (Priest) on Feb 24, 2003 at 18:20 UTC |