tags:

views:

266

answers:

1

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.

+8  A: 

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

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

Here's a short globbing tutorial.

Stefan Kendall
thanks for the quick response. worked great.
yankee2905
If you are using something other than `/` to delimit your regex, you need to prefix the regex with m. Also, you might need to escape your /s.
Thomas Owens
Thomas, there's no regular expression involved here. It's a glob, which uses shell-like wildcard syntax, not regular expressions.
Rob Kennedy
`glob("/home/test-*.txt")` is another way of saying the same thing.
mobrule