in reply to Renaming a group of files by referring to a list
A hash lets you index the elements by a string, so rather than searching an array (via List::Compare) for the matching element, you can write things like:
You might even be able to squeeze all the code into File::Find::find()'s \&wanted parameter (though risky as you'd be changing the data File::Find is looking through).%rename_hash = ( 'oldname' => 'newname' ); if( exists $rename_hash{ $filename } ) # Does this file get changed? { ... } $newname = $rename_hash{ $filename } # What's the new name? ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Renaming a group of files by referring to a list
by squirell (Initiate) on Dec 11, 2007 at 02:34 UTC |