my %cmd_steps = ( 1 => "/bin/ls", 5 => "/bin/uname", 10 => "/bin/dmesg", 15 => "/bin/date", 20 => "/bin/hostname", 25 => "/bin/mount", 30 => "/usr/bin/dir", 35 => "/usr/bin/lpq", 40 => "/bin/ps", ); my $next_step = 15; foreach my $step ( sort { $a <=> $b } keys %cmd_steps ) { next unless $step >= $next_step; print "Step: $step - Cmd: $cmd_steps{ $step }\n"; my $out = `$cmd_steps{$step}`; print $out; print "="x80, "\n"; }