There are several ways depending upon what you require. In your sample above, you are capturing the output from the program (i.e. STDOUT) and placing it into the variable. Depending upon what is written to STDOUT, you would have to parse the results to determine success or failure. But it depends on the program producing output which indicates success or failure as a precondition.
If you know the UpdateDate.exe returns 0 on success and other values on failure (precondition: if it return the same value regardless, it may not be worth capturing any information) and you are not interested in the output, then you can use the function system. Using your example from above, it would look something like:
my $idValue = 0;
my ($cmd) = "UpdateData.exe -getid $projectName $testName idValue";
# Save the returned value from the program execution
$idValue = system($cmd);
# Print out the returned value.
print $idValue;
# shift value by 8 to get the exit code.
if ( 0 != ($idValue >> 8) )
{
# Issue and take action if required
}
Here is a link to which gives a excellent explanation of system and back tick differences:
What's the difference between Perl's backticks, system, and exec?