Here is my example:
open(HWIDS,"devid.txt") or die !; whileAnother option, you can use ` to issue the system command and get the result back.{ print "About to disable the device $_,\\n"); system("devcon disable $_"); #<--------- err line } close(HWIDS);
use strict; #good habit to use this. my $output; open(HWIDS,"devid.txt") or die !; while{ print "About to disable the device $_,\\n"); $output = `devcon disable $_`; print "Result:\\n", $output; } close(HWIDS);