Suggestion:
instead of creating the filename twice, like in
open my $OUT, '>>', "$mycrdir/file_detail.txt" or die "Can't create '$
+mycrdir/file_detail.txt'" ;
it is better do it once and use a variable
my $filename = "$mycrdir/file_detail.txt";
open my $OUT, '>>', $filename
or die "Can't create '$filename'";
The reason is to avoid any chance of updating the filename used for open() but forgetting about the error message.
one more improvement - include the reason why the open failed
open my $OUT, '>>', $filename
or die "Can't create '$filename': $!";
P.S.: You are using UNIX-Style forward slashes on a Windows-Platform: D:\.../file_detail.txt You probably want to fix that. |