in reply to Re: Read files not subdirectories
in thread Read files not subdirectories

wow. never realized all such things at glance! this is DynamitePerl (maybe it is worth a new section.. ;=) ).
Anyway, with the excuse of explaining your code to the OP, i'll try to describe it further with the hope to retain it in memory..
my @files = <*.txt>;
This is almost easy, but not completely. The clue is in a big section of perlop concerning IO Operators:
while speaking about diamond operator <>

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.

So,if no all glitter is gold, not all diamonds contain filehandle..
The keyword in the above sentece result to be glob and in his own manpage is stated:
This is the internal function implementing the <*.c> operator, but you can use it directly. If EXPR is omitted, $_ is used.

This lead to the second code:
#To process every line of those files one at a time, use: { local @ARGV = <*.txt>; while( <> ) { # $_ contains the lines of the files one at a time; for each f +ile in turn # To display file(line no): line for every .txt file in the cu +rrent directory use: chomp; print $ARGV, '(', $., '):', $_; } }
Docs state:
The null filehandle <> is special: it can be used to emulate the behavior of sed and awk, and any other Unix filter program that takes a list of filenames, doing the same to each line of input from all of them.

..

Here's how it works: the first time <> is evaluated, the @ARGV array is checked,..

..read also the missing part..

You can modify @ARGV before the first <> as long as the array ends up containing the list of filenames you really want.


So the first diamond is used on a (localized!) @ARGV to fill it whit a list of files created via glob and then the second diamond is that special one.

HtH
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.