in reply to File handle problems
As well as the = instead of =~ problem that other people have already addressed, what are you doing with the values in the captures?
{ (@alternative_ids, $8)}
doesn't do anything, as far as I'm aware. You might want to be pushing (perldoc -f push) values onto that array.
Also, you have one use of @alternative_id, when all the rest are @alternative_ids. You could look into the use of use strict; to avoid this sort of typo.
edit: Another thing is that for $2, $3 etc. you already know that they match /.{0,50}/, since that's how you grabbed them from the original regex. To subsequently check them with /.{1,50}/ is (to me) a bit of overkill. You could just use either if $2 (or $2 =~ /./ if $2 is allowed to be '0')
edit:Another thing to note, and one that's very important (it just occurred to me when I was thinking of something else) is that if you have $1, $2, $3 etc, and then run another match, they will all get wiped out. So as soon as you do:
if ($2 = /.{1,50}/){ (@alternative_ids, $2)};
all your subsequent tests (and whatever you were wanting to do with $2 in that block) are to no avail. $3, $4, $5 etc. simply aren't there any more. You'll have to assign them to slightly more persistent variables beofre running any matching tests on them.
Jasper