and the code below, I'm blocked forever (on reading from STDIN ?!!) when running it like

$ ./weird.pl sample.txt

whereas

$ ./weird.pl <sample.txt

or

$ cat sample.txt | ./weird.pl

works perfectly OK. I'm trying to make a number of DNS requests in an async manner, controlling the maximum number of open sessions at any time and processing the names of the hosts to be checked in a 'stream-like' fashion.

I have work-arounds, so I'm not looking for alternate solutions, but I'm just trying to understand why this code doesn't work and blocks, apparently when hitting the end of the file given on the command line.

Am I doing something that isn't right or is Perl this time not keeping it's promesses about how files on the command line are processed ...?