in reply to Stop apache server

I am not sure I understand what you are really asking. If all you want to do is execute 'servicectl stop' from within perl, you can just:
my $result=`servicectl stop`;
$result will contain any output it produces