in reply to array and hash
can be done shorter, more efficient, but gives the idea to you.#untested, no perl on the current machine... my @array= qw ( command1 command2 command3); my %hash = (); foreach (@array) { $output = eval($_); $hash->{$_}= $output; } sub command1() { # do something return 1; }
|
|---|