<p>On researching another question I noted that the <code>stat</code> function in Perl can take a dirhandle as its argument (instead of a filehandle or filename).</p>

<p>However I can't find any examples of correct use of this - there are none in the Perl manual.</p>

<p>Can anyone show an example of how to use it?</p>

You use it just like you would
```
stat
```
on a filehandle:
```
```
<~> $ mkdir -v foo ; perl -e 'opendir($dh , "./foo"); @s = stat $dh; print "@s"'
mkdir: created directory `foo'
2049 11681802 16877 2 1001 1001 0 4096 1228059876 1228059876 1228059876 4096 8
```
```
(Personally, I like using
```
File::stat
```
to get nice named accessors, so that I don't have to remember (or lookup) that the fifth element is the UID...)