Two things: one, I had a similar question on the functioning of glob in a scalar context not to long ago. You may want to take a look at it Fileglob in a scalar context and More fileglob in a scalar context.
As for better ways to do it, yes you could use opendir, readdir, and grep, and while it is not relevent to this case, you should take a look at the docs for the -X file test commands as they are very useful, and for some reason, often missed by programmers new to perl.
Scott
In reply to Re: glob weirdness / list contexts?
by scain
in thread glob weirdness / list contexts?
by giantfish
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |