in reply to <> oddity ?
reads from STDIN. Try this script:
This should behave similar to yours under your 3 scenarios.
$ ./weird.pl sample.txt
$ ./weird.pl <sample.txt
$ cat sample.txt | ./weird.pl
Once (shame on you!)
Twice (shame on me!)
More often than I'd like to be
All the time
Just when answering stupid polls
Who you callin' a fool?
I refuse to vote in this ridiculous poll
Results (430 votes). Check out past polls.