You can use backticks to capture STDOUT. Since you are using cp, which doesn't output to STDOUT, you can merge STDERR into STDOUT, and capture errors that way. Then use && to string the commands together. Something like (untested):
my $err = `(cp xyz.dat abc.dat && cp xyz.dat2 abc.dat2) 2>&1`;
if ($?) {
print "Error message: $err";
print "Exit status: ", $? >> 8;
}