in reply to How is outputting to an array different from outputting to a file
In other words, if your first example (reading from the file) actually works, then all you need to do is replace these lines:my $data =`lpstat -o -v -d -p -l -D`;.
with the one back-tick line I showed above, and everything else should stay the same and still work.system("lpstat -v -d -p -l -D >junk.txt"); open RI,"<junk.txt" || die "Can't open junk.txt for reading:$!\n"; my $data = do { local $/; <RI> };
|
|---|