I am trying to execute a simple strawberry perl script for file copy to get the code from the last executed command. But I get 0/success in all the case.
Code from my test.pl script
use File::Copy;
use strict;
use warnings;
my $source_file = "D:\\abc\\def\\in\\test\\test1.csv";
my $target_file = "D:\\abc\\def\\in\\test\\test2.csv";
if ( copy( $source_file, $target_file ) == 0 ) {
print "success";
}
else { print "fail"; }
Since the path I used D:\\abc\\def\\in\\test\\test1.csv
does not exist on the machine so I expect to get fail but I get success no matter what I provide.
Following the execution and output:
D:\pet\common\bin\backup>perl test.pl success