Your Perl script runs fine for me. Don't change anything. Use it exactly as it is.
In reply to Re: How to read from a .txt by Jim in thread How to read from a .txt by stamp1982