Movatterモバイル変換


[0]ホーム

URL:


functions /glob
(source,CPAN)
You are viewing the version of this documentation from Perl 5.12.0.View the latest version
#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 thatglob splits its arguments on whitespace and treats each segment as separate pattern. As such,glob("*.c *.h") matches all files with a.c or.h extension. The expressionglob(".* *") matchs all files in the current working directory.

If non-empty braces are the only wildcard characters used in theglob, no filenames are matched, but potentially many strings are returned. For example, this produces nine strings, one for each pairing of fruits and colors:

@many =  glob "{apple,tomato,cherry}={green,yellow,red}";

Beginning with v5.6.0, this operator is implemented using the standardFile::Glob extension. SeeFile::Glob for details, includingbsd_glob which does not treat whitespace as a pattern separator.

Perldoc Browser is maintained by Dan Book (DBOOK). Please contact him via theGitHub issue tracker oremail regarding any issues with the site itself, search, or rendering of documentation.

The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via thePerl issue tracker, themailing list, orIRC to report any issues with the contents or format of the documentation.


[8]ページ先頭

©2009-2026 Movatter.jp