in reply to why spaces! XML::DOM

It seems as if each element in the array @list contains two newline characters after them. You can remove them with a loop

my $element $element = substr $element, 0, -4 foreach $element @list; #You will still need to add the space though. #This solution is not that plausible.

Also, I do not think the else {} part of your code is needed. If the condition is met, the program will die, ergo no need for an else.

Update: Just realized this could also be done with a substitute function:

$element =~ s/\\n\\n/ /;
<(^.^-<) <(-^.^<) <(-^.^-)> (>^.^-)> (>-^.^)>

Replies are listed 'Best First'.
Re^2: why spaces! XML::DOM
by pjotrik (Friar) on Jul 10, 2008 at 10:16 UTC

    Oh come on, that's not very pretty... s/^\s+// and s/\s+$// would do nicely.

    But I still don't think that's the problem here

      Yeah, I read your response after I posted mine. (And shouldn't it be s/\s+$/ / ? Notice the space.)

      <(^.^-<) <(-^.^<) <(-^.^-)> (>^.^-)> (>-^.^)>