NAME
PerlIO::dir - Reads directories
SYNOPSIS
open my $dp, '<:dir', '.';
binmode $dp, ':encoding(cp932)'; # OK
my @dirs = <$dp>; # added "\n" at the end of the name
chomp @dirs; # if necessary
DESCRIPTION
PerlIO::dir
provides an interface to read directories.
There is an important difference between :dir
and Perl's readdir()
. This layer appends a newline code, \n
, to the end of the name, because readline()
requires input separators. Call chomp()
if necessary.
You can use seek($dir, 0, 0)
only for rewinddir()
.
seek $dir, 0, 0; # equivalent to rewinddir()
SEE ALSO
"opendir" in perlfunc, "readdir" in perlfunc, "rewinddir" in perlfunc, "closedir" in perlfunc.
AUTHOR
Goro Fuji (藤 吾郎) <gfuji (at) cpan.org>
LICENSE AND COPYRIGHT
Copyright (c) 2008, Goro Fuji <gfuji (at) cpan.org>. Some rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.