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

Re: How can I use printf FORMAT strings for (Win32) shell globs?

by RonW (Parson)
on Jul 17, 2017 at 21:19 UTC ( [id://1195280]=note: print w/replies, xml ) Need Help??


in reply to How can I use printf FORMAT strings for (Win32) shell globs?

printf format codes are also used by scanf, and String::Scanf provides format_to_re()

So, maybe something like:

# Untested # Use a printf/scanf pattern to match file names use String::Scanf qw(); use File::Find::Rule; my @w = qw( . ); # where to look my $f = $ARGV[0]; $f =~ s/[\012\015]+$//; # universal chomp() my $r = String::Scanf::format_to_re($f); my @files = File::Find::Rule->file() ->name( $r ) ->in( @w );

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-26 00:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found