in reply to Get a DH from <STDIN>?
When your program fails to open a directory handle, wait for it :), do NOT try to read from it, because the opendir call failed :)