use strict; system('cp','/path/to/file1','path/to/file2'); my $err_num=$?>>8; die "bad copy num:$err_num\n" if $err_num;