http://qs321.pair.com?node_id=11128394


in reply to Re^4: glob an array?
in thread glob an array?

> What did I miss?

It's possible to implement it without a regex.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^6: glob an array?
by LanX (Saint) on Feb 15, 2021 at 11:02 UTC
    Fun, our regex solutions are practically identical. :)

    But should be noted that real file globs are far more complicated to translate.

    They could include classes and ranges [ab-c] , alternativs {a,b,c} and all of this could be escaped.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Re^6: glob an array?
by Marshall (Canon) on Feb 16, 2021 at 03:15 UTC
    choroba, I enjoyed your code! - well written++.

    One issue that hasn't been discussed is case sensitivity. On my Win10 machine, file glob will be case insensitive. It is possible to create a Windows NTFS partition with filename case sensitivity. I've never done it, but such a thing is in theory possible. I don't what Perl file glob would do in that case or what it does on Unix?