use strict; #create the file mine.txt if doesn't exist if (! -e "mine.txt") { system("echo 'hey you' > mine.txt"); } #delete the file min.txt if exists if (-e "min.txt") { print "File unlink.txt ".unlink()."deleted \n"; } my $cmd1 = "rcp mine.txt cmd1.txt"; my $cmd2 = "rcp min.txt cmd2.txt"; my ($val1, $val2); if ($val1 = system("$cmd1")) { print "$cmd1 failed \n"; } if ($val2 = system("$cmd2")) { print "$cmd2 failed \n"; } print "val1: $val1 \n"; print "val2: $val2 \n"; print " done \n"; #### cp: cannot access min.txt val1: 0 val2: 0 done