in reply to Command lines Args and STDIN

It would be better to use <STDIN> instead of <>, as <> has magical properties when there are command line arguments. It will treat the command line arguments as a list of files to be read in sequence.

In the future please post all of the relevant code needed to reproduce your problem. Please make sure it is only the relevant code - trim it down until the problem stops occurring. And of course, the posted code should be runnable.

Also, please read the following: How (not) to ask a question - Only Post Relevant Code