Perl Best Practices, Chapter 8, "Built-in Functions", page 167: "Use glob, not <...>".

Conway argues that <> is overloaded with too many different meanings in Perl, leading to maintenance problems. After noting that changing:

my @files = <*.pl>;
to:
Readonly my $FILE_PATTERN => '*.pl'; my @files = <$FILE_PATTERN>; # KABOOM! (probably)
blows up in your face, he concludes that "a construct that breaks when you attempt to improve its readability is, by definition, unmaintainable". Use glob and keep the angle brackets strictly for input operations.

Update: Further to PBP, note Larry's sensible advice on language design:

Common operations should be "Huffman coded". That is, frequently used operators should be shorter than infrequently used ones.
In this case, file input is a more common operation than file globbing and so deserves the <...> shortcut. This was proposed back in 2000 in rfc 34:
Angle brackets have two separate meanings in Perl - file globbing and line input from a filehandle. This means that perl attempts to Do What I Mean and often misinterprets me. Since file globbing can be accomplished with the glob function and since file input is the more common use of angle brackets, they should not be used for file globbing.
Curiously, in Perl 6, <...> is no longer used for file input or file globbing, but as an improved version of Perl 5's qw operator. For file input, Perl 6 uses either $fh.readline(), or the shorter form =$fh. The Perl 5 built-in glob function is no longer built-in in Perl 6, but is now part of the IO modules (according to S29).


In reply to Re^2: Use 'ls' to read files in perl???? by eyepopslikeamosquito
in thread Use 'ls' to read files in perl???? by ad23

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.