I have a folder containing 96 files that I want to rename. The problem is that each file name needs a unique change...not like adding a zero the front of each name or changing extensions.  It isn't practical to do a search and replace.
Here's a sample of the names I want to change:

newSEACODI-sww2320H-sww24_07A_CP.9_sww2320H_sww2403F.fsa
newSEACODI-sww2320H-sww24_07B_CP.10_sww2320H_sww2403F.fsa
newSEACODI-sww2320H-sww24_07C_CP.11_sww2320H_sww2403F.fsa
newSEACODI-sww2320H-sww24_07D_CP.12_sww2320H_sww2403F.fsa
newSEACODI-sww2320H-sww24_07E_R.1_sww2320H_sww2403F.fsa
newSEACODI-sww2320H-sww24_07F_R.3_sww2320H_sww2403F.fsa
newSEACODI-sww2320H-sww24_07G_R.4_sww2320H_sww2403F.fsa
newSEACODI-sww2320H-sww24_07H_R.5_sww2320H_sww2403F.fsa


I'd like to use perl to change the above names to the below names, respectively:

SEACODI_07A_A.2_sww2320H_2403F.fsa
SEACODI_07B_A.4_sww2320H_2403F.fsa
SEACODI_07C_H.1_sww2320H_2403F.fsa
SEACODI_07D_H.3_sww2320H_2403F.fsa
SEACODI_07E_H.6_sww2320H_2403F.fsa
SEACODI_07F_H.7_sww2320H_2403F.fsa
SEACODI_07G_Rb.4_sww2320H_2403F.fsa
SEACODI_07H_Rb.9_sww2320H_2403F.fsa


Can such a thing be done?  I have a vague idea that I might make a text file with a list of the new names and call that list @newnames.  I would make another array out of the current file names, and call it @oldnames.  I'd then do some kind of for loop where each element $i in @oldnames is replaced by the corresponding $i in @newnames.

I don't know how to make an array out of my current file names, though, and so I'm not sure if this vague idea is on the right track.  I keep my files with the messed-up names in a directory called 'oldnames'. The below is my attempt to make an array out of the file names in that directory:

#!/usr/bin/perl -w
use strict; use warnings;

my $dir = 'oldnames';
opendir ('oldnames', $dir) or die "cannot open dir $dir: $!";
my @file = readdir 'oldnames';
closedir 'oldnames';

print "@file\n";


The above didn't seem to do anything. I'm lost. Help?


Question: Can I have an Animal Companions without being a druid or ranger?
Answer: Many, many classes have an archetype that grants an animal companion or other special access to them.  However, failing that, any character of at least level 4 may gain access to an animal companion via the Animal Ally feat, though most characters may have to wait to level 5 (the next feat level in pathfinder) to actually take the feat.  

In the specific case of a paladin, you must delay access to the Divine Bond ability by one level (probably by dipping a level of cleric or some such) in order to be eligible for the feat.  You could also give up the mount from that ability for the weapon option, but if you choose the mount option your hawk (or whatever) has an effective druid level of (your total level including your paladin levels)+(your paladin levels again)-3, which is pretty cool.  At level 6 this is the difference between an EDL 8 hawk and an EDL 3 hawk, which is a sufficient difference to necessarily alter how you use it in game.

Consider also that not all animals you use in combat or otherwise need to be animal companions.  Animal companions are special super-powerful bonded animals that you pretty much control directly.  You can get a loyal, useful, hunting hawk by training one with the Handle Animal skill.  If you want a normal hawk to use for rabbit hunts and message delivery, this is probably more appropriate.  If you want your hawk to scout out the enemy troop movements and report back, the animal companion version is a better bet.