--- name: glob status: documented runtime: pp source: src/runtime/pp/io.rs --- ```{index} single: glob; Perl built-in (pp runtime) ``` # glob ## Synopsis ```perl @files = glob('*.pl'); @files = glob('lib/**/*.pm'); @files = <*.txt>; # angle-bracket form ``` ## Description Expands shell-style filename patterns into matching pathnames. Expands the given pattern using shell globbing rules. Supports `*`, `?`, `[charset]`, `{alt1,alt2}` (brace expansion), and `~` (home directory). In list context returns all matches; in scalar context returns the next match (iterating on successive calls with the same pattern). The `` syntax is equivalent to `glob(PATTERN)`. When `File::Glob` is loaded, delegates to `bsd_glob` semantics where whitespace in patterns is treated literally. Otherwise, the default behaviour splits the pattern on whitespace to process multiple globs. Results are returned sorted and deduplicated. ## See also opendir, readdir, File::Glob