[plug] Perl $? equivalent

Mark O'Shea mark at musicalstoat.co.uk
Fri Mar 12 13:49:04 WST 2004


On Fri, 12 Mar 2004, Jay Turner wrote:
> Hi All,
>
> Can anyone tell me what (if any) the Perl equivalent to Bash's '$?' is.
>
> I am calling a program (`cat mailFile | sendmail -t`) from a perl script and
> I want to check that it has executed properly or not.
>
> In bash I would just "if [ $? -ne 0 ]" but I don't think I can locate an
> equivalent in Perl.
>
If I remember rightly:
$questionmark = system("cat mailFile | sendmail -t");
this should be what you need.

-- 
Mark O'Shea
mark at musicalstoat.co.uk



More information about the plug mailing list