in reply to Re: XML parsing
in thread XML parsing

This would add spaces into the data. If you do not want the data split into lines, do not split it. It's much better to assign all the data into a single scalar right away than to split it and then merge it back.

my $data = qx[$cmd];

Replies are listed 'Best First'.
Re^3: XML parsing
by mscharrer (Hermit) on Sep 17, 2008 at 15:23 UTC
    Yes, you are of course right. I was only looking on the xmlin line not on the qx one. However, the added spaces shouldn't do any harm in normal XML files.

    I had the "@array" version in mind because I used XML::Simple just this week and had to read the input file manually line-wise to fix a known broken tag before calling xmlin.

      Depends on what do you call normal. It will not corrupt the XML, but it may change the text content of some tags. Even in a data-oriented XML. I don't know about your XML files, but mine often do contain tags with several lines long content.

        Jenda, you are of course right in the general case. My original posting said "use stringification or join" to avoid that the 2nd and later lines are taken as XML::Simple options. I was just pointing the OP in the right direction and was trusting him to figure out if spaces are significant for his application or not. If so, a local $" = '' or, like I said before, a  join '', @array would do the job.

        BTW, my XML file was a XHTML website.