Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Wildcards for a wide array of strings?

by ww (Archbishop)
on May 23, 2017 at 12:25 UTC ( #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
Node Status?
node history
Node Type: note [id://1190958]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2020-09-28 06:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (143 votes). Check out past polls.

    Notices?