The problem is in @cmdout = $_; - where you continually initialize the array with the current line, methinx you actually meant to code push @cmdout, $_;
A user level that continues to overstate my experience :-))
Comment on Re: Why cant i save output of tasklist.exe in an array?