Reputation: 4452
In linux, I can do a stat on a file in the proc directory and determine if it is a socket.
root@dev:/proc/2221/fd# stat 100
File: `100' -> `socket:[125598]'
How can I get this same result with perl?
Upvotes: 1
Views: 159
Reputation: 6531
If you only want to know if it is a socket, then:
if(-S $file_name) { /* do something */ }
Upvotes: 3