(Perl:)
The glob built-in function performs exactly UN*X-style filename globbing, as detailed in the Jargon File (entry below). Specifically, it globs according to the same rules as csh does.

This glob may also be referred to by using an appropriate pattern inside angle brackets.

To print all files ending in `rc', use either of these:

print "$_\n" while ($_ = glob '{.,}*rc')
-OR-
print "$_\n" while (<{.,}*rc>)
To print all choices of one of a,b,c, one of d,e and one of f,g,h, use either
print "$_\n" while ($_ = glob '{a,b,c}{d,e}{f,g,h}')
-OR-
print "$_\n" while (<{a,b,c}{d,e}{f,g,h}>)
Note that csh globbing rules do not make any reference to existing files when expanding curly braces, so it works. (This trick is probably due to the illustrious Randal Schwartz).

In an interesting reversal of the history of glob in the Bourne shell (see Jargon File entry below), originally glob was built into perl; since v5.6.0, however, "this operator is implemented using the standard "File::Glob" extension".

Confusingly, `glob' is also used in Perl as a shorthand for typeglob.

glitch = G = glork

glob /glob/, not /glohb/ v.,n.

[Unix; common] To expand special characters in a wildcarded name, or the act of so doing (the action is also called `globbing'). The Unix conventions for filename wildcarding have become sufficiently pervasive that many hackers use some of them in written English, especially in email or news on technical topics. Those commonly encountered include the following:

*
wildcard for any string (see also UN*X)
?
wildcard for any single character (generally read this way only at the beginning or in the middle of a word)
[]
delimits a wildcard matching any of the enclosed characters
{}
alternation of comma-separated alternatives; thus, `foo{baz,qux}' would be read as `foobaz' or `fooqux'

Some examples: "He said his name was [KC]arl" (expresses ambiguity). "I don't read talk.politics.*" (any of the talk.politics subgroups on Usenet). Other examples are given under the entry for X. Note that glob patterns are similar, but not identical, to those used in regexps.

Historical note: The jargon usage derives from glob, the name of a subprogram that expanded wildcards in archaic pre-Bourne versions of the Unix shell.

--The Jargon File version 4.3.1, ed. ESR, autonoded by rescdsk.

Log in or register to write something here or to contact authors.