This code will not compile, it appears to be missing significant sections, ie, the beginnings of the two blocks you are ending with unmatched }. Please post working code.
my @lines = $filewill store the file name in the array. I suspect you actually want to read the lines out of the file into @lines.
foreach my $file (readdir DIR) { next unless -f $file; open my $in_fh, '<', $file; my @lines = <$in_fh>; close $in_fh; # call subroutine here }
You will probably want to call a subroutine where indicated to process @lines and write your output file, since your array will cease to exist once the foreach loop is finished.
Updated per below
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Have a multiple file in directory and want to manipulate in each files in incremental order. All the file have same value.
by hexcoder (Curate) on Dec 23, 2014 at 16:38 UTC |