Running more than one function from a subroutine

Hi All

I am new to perl so had one question.
I have one Subroutine which works as expected and below is just an example.
where I ran a command and check the output.
so my question is if I have more than one command then how to check the results, meaning I want to add more command and check the results of each one after another.Thanks for your help

example of new command can be
my $command2 = fdisl -l;
my $command3 = du -f;

========================================
sub testSub{
my $variable1 = test 123;
my $variable2 = linux;
my $command1 = uanme -a ;

if ($?) {
push (@$errors ,"uname -a is failed for $hostname" );
} else {
$Log->LogInfo("uname -a passed for $hostname");

Pass the command as an argument to your subroutine so that u can run the subroutine for 'n' no.of commands.

Store all the commands in an array and use 'foreach' loop to call the subroutine for each element i.e command in the array.

Hope this will solve your issue!

Thanks
Tannu