Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^5: glob an array?

by choroba (Archbishop)
on Feb 15, 2021 at 06:24 UTC ( #11128394=note: print w/replies, xml ) Need Help??


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 (Cardinal) 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?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11128394]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2021-04-10 22:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?