in reply to Re: Unable to read a file
in thread Unable to read a file

It appears you changed the line

open(FH,"$file") or die "Can't read the file\n";

to

open(FH,"$dest_dir./$file") or die $!;

However, you read the files from $dir not $dest_dir, so obviously they will not be found.

Also, you do not need the period/dot:

open(FH,"$dir/$file") or die $!;

As mentioned before, get rid of the period/dot on this line:

open(FH1,">$dest_dir./result.txt") if( $len > 0);

Should be

open(FH1,">$dest_dir/result.txt") if( $len > 0);

Or better yet, use the three argument form of open:

open(FH1,'>',"$dest_dir/result.txt") if( $len > 0);

Of course it would be good if you checked whether the open failed or not.

HTH, Ken