The answers to most "how does this operator work?" questions can be found in perlop. In this case it's described in the IO Operators section of that document, where this is explained:
If what's within the angle brackets is neither a filehandle nor a simple scalar variable containing a filehandle name, typeglob, or typeglob reference, it is interpreted as a filename pattern to be globbed, and either a list of filenames or the next filename in the list is returned, depending on context. This distinction is determined on syntactic grounds alone. That means <$x> is always a readline() from an indirect handle, but <$hash{key}> is always a glob(). That's because $x is a simple scalar variable, but $hash{key} is not--it's a hash element. Even <$x > (note the extra space) is treated as glob("$x ") , not readline($x).
The document continues for a couple more paragraphs explaining in better detail what globbing is, and how it works with the diamond operator. And of course now we have the "how does the glob() function work?" question, which is answered by perldoc -f glob.
The original question of "how do I add text files to this list?" can be answered by doing two globs:
my @list = (<*.xml>, <*.txt>);
Or by pushing elements from list two onto the array, or by using traditional shell file expansion mechanisms, described in File::Glob:
my @list = <*.{xml,txt}>
Dave
In reply to Re: A bizarre way to get a list of filenames
by davido
in thread A bizarre way to get a list of filenames
by kiz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |