in reply to File handle problems

it is the lines starting with:

if ($2 = /.{1,50}/){ (@alternative_ids, $2)};
You have used the assignment rather than the binding operator =~

/J\