Much of your script does nothing -- other than that, everything is great :)
What are you trying to accomplish with:
foreach my $file (@the_files) {
foreach $key (keys %image_hash) {
$file=~ s/$key/$image_hash{$key}/g;
}
}
You modify a local variable without doing anything with it.
Then, your actual attempt at moving the files does nothing, because you do not catenate a file name to your src and dst directories. You are also using 'move', but your initial explanation said 'new' files, implying you wanted copies.
It looks like what you want is some modification of the above nested loop within the bottom move/copy loop. You need the file name from @the_files to append to $here, and the replaced name to append to $there.
Finally, that nested substitution loop is dangerous. It may not properly process files where names are similar, such as 'game.gif' and 'agame.gif'. Best to use 'eq' to match the filename first, before doing the substitution.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.