in reply to Hex value 1A terminates <>


You probably need to binmode the filehandle:
... open FILE, 'test.txt' or die "Error message here: $!\n"; binmode FILE; ...

ASCII 26 is CTRL-Z on Windows and indicates the end of file.

--
John.