in reply to How is outputting to an array different from outputting to a file
The short and long of it: replace this from the first snippet:
With this: my $data = `lpstat -v -d -p -l -D`; An array isn't really necessary. In fact, in your example you were putting the entire results of the command into only the first element of your array.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> }; # or however you load it.
blokhead
|
|---|