Need help in perl scripting !!?

Appollo

New member
Hello i am new to perl scripting.
I would like to know how do we check the output of a system command using perl.
For example, if mysql is restarted i want to print success

-------------------------------------------------


#!/usr/bin/perl
print "Hello, Perl! \n";
$a='service mysqld restart';
if(system("$a")==1)
{
print "success";
}
else
{
print "failed";
}



------------------------------------------------


i have written a code but the condition checking...i got stuck...cud anyone help me please



All help much appreciated

Thanks in advance :)
 
Back
Top