http://qs321.pair.com?node_id=1025667


in reply to <> oddity ?

while(<>)

reads from STDIN. Try this script:

while(<>) { print; }

This should behave similar to yours under your 3 scenarios.

$ ./weird.pl sample.txt whereas $ ./weird.pl <sample.txt or $ cat sample.txt | ./weird.pl
UPDATE: I am stupid and should read "Programming Perl" again. Apologies for posting useless stuff. No idea what goes wrong with your code.