my @files=<*.text>;#scans for .txt extensn in the curent dir local @_=@files; foreach my $file(<>)
The @_ array has no relation to the special <> readline operator so your program is reading all lines from all files listed in the @ARGV array, or from STDIN if @ARGV is empty and storing them in a list in memory and then iterating over them from that list and the files listed in @files are ignored.
If you want to use <> you have to store your file names in @ARGV and you should probably also use a while loop instead of a foreach loop:
local @ARGV = <*.text>;#scans for .txt extensn in the curent dir while ( my $line = <> )
In reply to Re: reading textfiles into 1 whole file
by jwkrahn
in thread reading textfiles into 1 whole file
by luckysing
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |