Covert simple bash script in perl language

Hello,

Anyone please covert this in perl language
########################

if ps faux | grep -v grep | grep ProcessXYZ 

then

      echo "$SERVICE is running, , everything is fine"
exit 0

    else
          echo "$SERVICE is not running"
             exit 2
fi

Additional Info
##############
( exit 0 and 2 to be used for simple nagios test plugin , exit 0 = OK and exit 2 = Critical )

My own guess is, it should be somewhat similar to:

#!/usr/bin/perl
if ps faux | grep -v grep | grep ProcessXYZ {
print "OK\n";
exit (0);
}

else {
print "CRITICAL\n";
exit (2);
}

Hello!

Here is the code:

#!/usr/bin/perl
$result = `ps faux | grep -v grep | grep 'ProcessXYZ'`;

##if you want to see the error level, uncomment the below.
#print "Error Level: " .$? ."\n";

if ( $? == 0 )
{
        print "OK\n";
        exit (0);
}
else
{
        print "CRITICAL\n";
        exit (2);
}