I'm not sure why you get different results, but I'm pretty sure using Perl IO via
open is better suited than buffering stuff from
qx
Anyway from the docs
- In scalar context, it comes back as a single (potentially multi-line) string, or undef if the shell (or command) could not be started. In list context, returns a list of lines (however you've defined lines with $ or $INPUT_RECORD_SEPARATOR), or an empty list if the shell (or command) could not be started./
So your list context might lead to splitting into smaller parts ("lines")