in reply to looking for suggestion!!!
for (my $element = 0; $element<$total_element; $element++)
Don't. Use the following instead:
for my $command (@run) { ...
This is much saner, as you don't need to know about $total_element and cannot make errors by using $element in a wrong way.
Also, please check the return value from system instead of only querying $?. Use the following:
if (system( $run_cmd ) != 0) { print "Running command '$run_cmd' failed: $!/$?\n"; $err = 1; };
|
|---|