it could cause unintended and confusing side effects

It's of course a matter of opinion, but I do agree with this - it's a neat but somewhat obscure use of glob. It can be useful, as it allows one to generate combinations using just core Perl, without loading e.g. Algorithm::Combinatorics. But all it takes is someone who doesn't know the details ("If non-empty braces are the only wildcard characters used ...") or the interpolation of unchecked variables into the pattern for it to break. Personally, my feeling is that in a one-off script, or with a fixed string plus a comment warning future maintainers, it's ok to use. But if you want to play it safe with respect to future maintainers, I'd avoid it.

As for using <a b c> as a replacement for qw/a b c/, sure it's clever, but IMO it's a silly place to save two characters, and I'd probably recommend against it. Also, I like to use File::Glob ':bsd_glob';, which breaks it:

$ perl -le 'print for <a b c>' a b c $ perl -MFile::Glob=:bsd_glob -le 'print for <a b c>' a b c

In reply to Re: Creating arrays with glob patterns without metacharacters by haukex
in thread Creating arrays with glob patterns without metacharacters by Lotus1

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.