in reply to Code for parsing an array of hashes

As you wrote it, it's an array of hashes of hashes. Actually it would make more sense to write it as an array of arrays of hashes to be clear about the ordering, otherwise you'd have to sort the keys when retrieving them and the sort order is sometimes not very intuitive---e.g. does "step10" come before or after "step1", or do you have to number the steps starting with "step01" then? The same goes for the parameter lists (and they're so much easier to both write and use if they're arrays already), so I'd make it something like this:
use strict; use warnings; use 5.010; my @tests = ( [ # first testcase { # first step command => 'Launchapplication', params => [ qw/ executablepath dirpath / ], }, { # second step command => 'SelectMenu', }, # ... ], [ # second testcase { # first step command => 'Launchapplication', params => [ qw/ executablepath dirpath / ], }, { # second step command => 'Dothis', }, # ... ] ); my $package = "My::Package"; CASE: for my $ncase (0 .. $#tests) { my $case = $tests[$ncase]; foreach my $nstep (0 .. $#$case) { my $step = $case->[$nstep]; if(defined $step->{command}) { my $ok = 1; try { no strict 'refs'; "${package}::$step->{command}"->(@{ $step->{params} // + [] }); } catch { warn sprintf("FAILURE test %d step %d failed, aborting +", $ncase+1, $nstep+1); $ok = 0; # can't use "last" here due to try/catch limi +tation }; last CASE unless $ok; } else { warn sprintf("BUG: `command' undefined in test %d step %d" +, $ncase+1, $nstep+1); last CASE; } } }
Edit: oops, Riales beat me to it :)