in reply to Finding Files and Processing them iteratively

There are plenty of ways to do this™. You have files which match a set pattern, which lends itself very naturally to the use of glob.
# All "R" data files my @data_r = glob "*R.fa"; # All "P" data files my @data_p = glob "*P.fa";
You don't necessarily need to glob both filename patterns, as you may not be that worried about detecting problems with the dataset itself. I think I would want to validate this, though. I'd want to know if there were more or fewer data*R.fa vs data*P.fa files, or if the number is the same, but the names themselves didn't match up. You can use List::Compare to find out if the two arrays are the same.

You can get the base datafile names like this:

my @base_data = map substr($_, 0, length($_) - 4), @data_r;
From there it is pretty easy to open and process each set of files (data#R.fa, data#P.fa) iteratively.