in reply to opendir a directory abstraction?

But is there a way to do it with opendir ,too?

No; the ability to open a variable as a file is derived from PerlIO (and is only available if your perl was built with PerlIO, which has been default since 5.8) and PerlIO only handles byte-streams and not directory-streams. On a related note, you cannot tie directory handles either when I last checked.

$ perl -e '$str="foo";' \
       -e 'open FH, "<", \$str or die "open: $!";' \
       -e 'print "var:   ",join(":",PerlIO::get_layers(FH)),"\n";' \
       -e 'print "STDIN: ",join(":",PerlIO::get_layers(STDIN)),"\n";'
var:   scalar
STDIN: unix:perlio