in reply to A bizarre way to get a list of filenames

It's called file-glob and is using the same diamond operator like readline

And yes I agree it's confusing °, and due to the scripting ("Bash on steroids") heritage of Perl4.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

°) even the parser is sometimes confused, because it decides based on the inner pattern which operator is meant.

  • Comment on Re: A bizarre way to get a list of filenames

Replies are listed 'Best First'.
Re^2: A bizarre way to get a list of filenames
by haukex (Archbishop) on Aug 05, 2019 at 15:36 UTC
    even the parser is sometimes confused

    Nitpick: Unlike other cases, such as map or //, I think the rules for when <...> is readline vs glob are pretty clearly spelled out in I/O Operators.

    kiz: Note that using glob has several caveats, described in To glob or not to glob. In this particular example that you showed in your post, it's probably fine.

      > pretty clearly spelled out in I/O Operators

      here I agree with the docs

      These days, it's considered cleaner to call the internal function directly as glob($foo), which is probably the right way to have done it in the first place .)

      I passively remember very hairy edge cases here, and sometimes people try to overload <> for their own iterator use and fail because of edge cases. It's our main iterator operator after all.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

        sometimes people try to overload <> for their own iterator use

        You mean like me? But I didn't fail, at least I don't think so ;-)