Edited by snrguptha on 09/23/03 09:00 AM (server time).
my $cmd = "some-clt-with-parameters";my ($results, $status) = ('', 0);if (use-backticks){ $results = `$cmd 2>&1`; $status = $? >> 8;}elsif (use qx){ $results = qx($cmd 2>&1); $status = $? >> 8;}elsif (use a pipe){ if (open(PIPE, "$cmd | 2>&1")){ local $/; $result = <PIPE>; close(PIPE); } $status = $? >> 8;}elsif (use system){ $status = system($cmd); $status >>= 8; # I think this is still required}