in reply to input from STDIN or from a file

I don't see anything wrong with it, but I normally just use the <> filehandle instead (see "I/O Operators" in perlop).