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

glob

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 <PATTERN> 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.

Synopsis

@files = glob('*.pl');
@files = glob('lib/**/*.pm');
@files = <*.txt>;         # angle-bracket form

See Also

opendir, readdir, File::Glob