What Perl glob expression matches all the files that look like /home/test-N.txt?

StackOverflow https://stackoverflow.com/questions/1590848

  •  22-09-2019
  •  | 
  •  

Question

I am a beginner to Perl syntax and have a basic wildcard question. I am looking for an expression that would allow me to retrieve all of the following files.

/home/test-1.txt  
/home/test-2.txt  
/home/test-3.txt

I am just interested in the actual wildcard expression, not the file I/O.

Was it helpful?

Solution

</home/test-*.txt> should glob the files you need.

glob("/home/test-*.txt") does the same thing.

Here's a short globbing tutorial.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top