Skip to content

Commit

Permalink
Specify that < > is alternate syntax and add ( ) around example calls
Browse files Browse the repository at this point in the history
  • Loading branch information
scottchiefbaker committed May 26, 2021
1 parent 8de26a8 commit 933cd32
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions pod/perlfunc.pod
Expand Up @@ -3385,6 +3385,12 @@ is discussed in more detail in L<perlop/"I/O Operators">.
# Do stuff
}

Glob also supports an altnernate syntax using C<< < >> C<< > >> as
delimiters. While this syntax is supported, it is recommended that you
use C<glob()> instead as it is more readable and searchable.

my @txt_files = <"*.txt">;

Note that L<C<glob>|/glob EXPR> splits its arguments on whitespace and
treats
each segment as separate pattern. As such, C<glob("*.c *.h")>
Expand All @@ -3396,20 +3402,20 @@ For example, to glob filenames that have an C<e> followed by a space
followed by an C<f>, use one of:

my @spacies = <"*e f*">;
my @spacies = glob '"*e f*"';
my @spacies = glob q("*e f*");
my @spacies = glob('"*e f*"');
my @spacies = glob(q("*e f*"));

If you had to get a variable through, you could do this:

my @spacies = glob "'*${var}e f*'";
my @spacies = glob qq("*${var}e f*");
my @spacies = glob("'*${var}e f*'");
my @spacies = glob(qq("*${var}e f*"));

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

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

This operator is implemented using the standard C<File::Glob> extension.
See L<File::Glob> for details, including
Expand Down

0 comments on commit 933cd32

Please sign in to comment.