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


in reply to Distinguishing a filehandle for an in-memory string

What you want to know is whether it's a system file handle or not. You can use fileno for that. It returns -1 for file handles that aren't system file handles (such as the in-memory string handles).