What delimits the records in your file? What is the <STDIN> part doing?
P.S. Use the three argument open if your perl supports it. You may also prefer to use a lexical an indirect filehandle also, e.g., open my $FILE, '<', $file or croak "Could not open '$file': $!";