I want to have output of Windows command-line program (say, powercfg -l) written into a file which is created using Perl and then read the file line by line in
powercfg -l
Try using > operator to forward the output to a file, like:
powercfg -l > output.txt
And then open output.txt and process it.