sub eval_cmd { my $key = shift; die "no such command: $key!" unless exists $cmd_template{$key}; my $cmd = $cmd_template{$key}; no strict "vars"; for my $var (@all_my_vars) { $cmd =~ s/\$var/$$var/g if defined $$var; } use strict "vars"; return $cmd; }