#!/usr/bin/perl -w opendir FD,'/proc/self/fd' or die "Can't open FDs - $!\n"; my @FDS = grep !/^\.{1,2}$/, readdir FD ; print "@dirs";