The error message indicates that
$line still has a line break at its end (&DoIT starts on a new line). It seems that your chomp is not working probably because the input file has different line endings as the computer you run the script on. Was the input file created under Windows and the script running under Linux now? Was the different machine from a different type, i.e. a Windows machine?
First of all add at the very beginning:
use strict;
use warnings;
#use diagnostics; # if you get warnings
and then, to be save:
$line =~ s/\015?\012?\Z//m;
after
chomp($line=<IN>);
Tell us if the problem disappears.