use XML::Simple; .. my @outputInfo = qx[$cmd]; # Discard that pesky first line, without needing to know # what the line ending chars are shift @outputInfo; # Join array to make a single string, with line endings # being turned into line endings (but not necessarily # exactly the same line endings as the command may have # used, depending on your OS, and/or the internals of the # command) my $ref = XMLin(join("\n", @outputInfo));