Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

File::Glob

Native Rust implementation built into the interpreter. Runtime: PP. See original documentation for the full Perl reference.

Provides BSD glob pattern matching via libc’s glob().

Functions

GLOB_ERROR

Return the error code from the most recent bsd_glob or csh_glob call. Returns 0 if the last call succeeded.

use File::Glob ':bsd_glob';
my @f = bsd_glob("/no/such/*");
warn "glob error" if GLOB_ERROR;

Perl equivalent: File::Glob (core module, XS-based)

bsd_glob

Expand a glob pattern into matching filenames using BSD-style semantics. Accepts an optional flags argument to control matching behavior.

use File::Glob ':bsd_glob';
my @files = bsd_glob("*.pl");
my @files = bsd_glob("~/src/*.rs", GLOB_TILDE | GLOB_BRACE);

csh_glob

Expand a glob pattern using csh-style defaults (GLOB_BRACE | GLOB_NOMAGIC | GLOB_QUOTE | GLOB_TILDE | GLOB_ALPHASORT). This is the function called internally by Perl’s <*.pl> glob operator.

use File::Glob ':glob';
my @files = csh_glob("*.{pl,pm}");