# File::Glob
📦 min
POSIX pathname globbing — expand shell-style wildcard patterns into lists of filenames.
`File::Glob` is what backs Perl’s built-in `glob` operator and its
angle-bracket form `<*.pl>`. Give it a pattern with shell metacharacters
(`*`, `?`, `[...]`, `{a,b,c}`, `~user`) and you get back the list of
paths on disk that match. The same machinery is exposed directly as
`bsd_glob` when you want explicit control over flags.
The mental model is simple: a pattern goes in, a list of real filenames
comes out. Behaviour is tuned by a bitmask of `GLOB_*` flags — tilde
expansion, brace expansion, case folding, sort order, and what happens
when nothing matches are all flag-controlled. Every flag has a named
constant (`GLOB_TILDE`, `GLOB_BRACE`, `GLOB_NOCASE`, `GLOB_NOMAGIC`,
`GLOB_CSH`, etc.) and they OR together.
Three call styles, same engine:
```perl
use File::Glob ':bsd_glob';
my @pl = <*.pl>; # angle-bracket form
my @c = bsd_glob('*.[ch]'); # function form, default flags
my @hd = bsd_glob('~gnat', GLOB_TILDE | GLOB_ERR);
```
The default flag set is `GLOB_CSH` — brace expansion, tilde expansion,
backslash quoting, alphabetical sort, and the `GLOB_NOMAGIC` fallback
that returns the literal pattern when it has no metacharacters and
doesn’t match. Two import tags nudge the default: `:nocase` turns
`GLOB_NOCASE` on globally, `:case` turns it off.
## Functions
### Globbing
#### [`bsd_glob`](Glob/bsd_glob.md)
Expand a shell-style pattern and return the list of matching paths.
#### [`csh_glob`](Glob/csh_glob.md)
Expand a pattern using the default flag set — the engine behind Perl’s built-in `glob`.
#### [`glob_error`](Glob/glob_error.md)
Report the error status of the most recent `bsd_glob` call.