in reply to How do I move array contents into a directory?

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.

Replies are listed 'Best First'.
Re^2: How do I move array contents into a directory?
by hexcoder (Curate) on Aug 29, 2008 at 18:05 UTC
    You modify a local variable without doing anything with it.

    He is not modifying a local variable, he is using an alias for the array elements. So it should have an effect.