Dear all.
I wrote a piece of code to read and open all files from a directory to do
something with it.
But I found that the variable assigned to @file_array split the file names
into pieces. For example ". . test.rpt" file will be separated into three
elements in an array, which are "." "." "test_rpt".
My question is how can I assign the entire file name to one variable without
spliting it?
Thanks,
AG
#!usr/local/bin/perl
use strict;
use warnings;
my $dirtoget="C:/perl/work/data/";
opendir (DIR, $dirtoget) or die 'Can not open DIR';
my @file_array;
@file_array =readdir(DIR);
closedir(DIR);
foreach my $filename (@file_array) {
print $filename;
open (IN, "$f") || die 'Can not open IN';
while(<IN>){
print $_;}
close(IN);}