I have a simple powershell script that calls a perl script. when the perl script fails, I would like to catch the error and put it into a variable.
The following actually works when I run it from powergui:
try
{
$erroractionpreference = "Stop"
perlexe c:\perlscript.pl -perlparameters param1
}
catch
{
$perlerror = $_.Exception.Message;
}
but when I run it from the powershell command prompt the $perlerror variable is not populated with the error message.
anyone knows why? is there a better way that I can catch perl errors?