When I try to run the code you posted, I only get these errors:
C:\>perl -w tmp.pl
Name "main::IN" used only once: possible typo at tmp.pl line 8.
Use of uninitialized value $id in seek at tmp.pl line 10.
seek() on unopened filehandle In at tmp.pl line 10.
readline() on unopened filehandle In at tmp.pl line 11.
Use of uninitialized value $name in concatenation (.) or string at tmp
+.pl line 3.