# This array of hashes keeps track of all test results my @tests = ( { name => 'Ping Test', subname => \&pingtest, result => 'Not performed' }, { name => 'Remdial', subname => \&remdial, result => 'Not performed' } ); # Loop through array of hashes and perform each test subroutine. foreach $x (@tests){ # Call subroutine. # What is the correct way to state this? # Without the references I would normally state # $result = testsub(); $x->{'result'} = $x->{'subname'}->(); print $x->{'result'}."\n"; # Stop testing if there is a failure. if ($x->{'result'} =~ m/Fail/) { last; } }