http://www.perlmonks.org?node_id=701534


in reply to RegExp eating my $1 - FIXED!

I haven't run your program yet, but a few things struck my eyes:

$line =~ m/^(.{6}).*/; my $ffc = $1;

Regexes are not always better/faster than anything else, in this case the substr function might be better.
E.g.:

my $ffc = substr($line, 0, 6);

If you want to assign the captured part of a match to a variable, you can do it like this:

my ($foo) = $bar =~ /(...)/;

Mind the parenthesises around $foo, the match returns a list of values.

Your loop through the keys of %files is uneccessary, use the exists function.

Perhaps you might be able to streamline your program a bit, so that the error is more obvious.