Manual

- Overview
- Tutorials
- FAQs
- History / Changes
- License

Reference

- Language
- Functions
- Operators
- Special Variables
- Pragmas
- Utilities
- Internals
- Platform Specific

Modules

- A • B • C • D • E
- F • G • H • I • L
- M • N • O • P • S
- T • U • X

News / Blogs

- Perl Buzz
- Perl Iron Man
- Perlsphere
- Planet Perl
- TPF news
- Use Perl

See also

- CPAN
- Perl.org
- Perl.com
- Perl 5 Wiki
- Perl Jobs
- Perl Mongers
- Perl Monks

Contact

- Site designed and maintained by Jon Allen (JJ)
- http://perl.jonallen.info

- View the project page and FAQs

# glob

Perl 5 version 10.1 documentation
Go to top

# glob

Perl functions A-Z | Perl functions by category | The 'perlfunc' manpage

- glob EXPR

- glob

  In list context, returns a (possibly empty) list of filename expansions on the value of EXPR such as the standard Unix shell /bin/csh would do. In scalar context, glob iterates through such filename expansions, returning undef when the list is exhausted. This is the internal function implementing the `<*.c>` operator, but you can use it directly. If EXPR is omitted, `$_` is used. The `<*.c>` operator is discussed in more detail in "I/O Operators" in perlop.

  Note that `glob` will split its arguments on whitespace, treating each segment as separate pattern. As such, `glob('*.c *.h')` would match all files with a .c or .h extension. The expression `glob('.* *')` would match all files in the current working directory.

  Beginning with v5.6.0, this operator is implemented using the standard `File::Glob` extension. See File::Glob for details, including `bsd_glob` which does not treat whitespace as a pattern separator.

Recently read

Tools

- Preferences