Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Wildcards for a wide array of strings?

by ww (Archbishop)
on May 23, 2017 at 12:25 UTC ( [id://1190958]=note: print w/replies, xml ) Need Help??


in reply to Wildcards for a wide array of strings?

For 'THE PROBLEM' you might want to consider using a loop, with a regex test for the files you want - a suggestion that infers from your text that the $from directory may contain non-.txt files.

#!/usr/bin/perl -w use strict; # 1190936 my @sourcefiles = <DATA>; for $_(@sourcefiles) { if ($_ =~ /.+?\.txt/ ) { # process it here -- simulated by; print $_; } else { next; } } __DATA__ foo.bar bar.txt baz.bat blivitz.txt; nottext and somethingelse.txt

Rewriting LN 5 to obtain data from your source directory is left as a (trivial) exercise -- once you do some reading, using perldoc open, for example.

execution:

C:\1190936.pl bar.txt blivitz.txt; somethingelse.txt

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-25 23:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found