in reply to new file per line output

There's one obvious bug, and a number of style or best practice issues. I'll list the ones I see, including the actual bug:

In script-line order:

Of all of these issues, the most significant is your use of split, which is splitting $_ by default, instead of $line, as you intend. Consequently, $stream and $timedate don't contain anything useful. Fix this issue, and then put in some error checking to ensure that your pattern matches are successful. That would have helped you to catch the misuse of split bug too, because with the split bug the pattern matches can't possibly be successful either.

One final note: You might be happy with a module like Text::Template, or minimally, a HERE doc, rather than a bunch of print statements with XML tags interspersed. Update: ...and you probably ought to be protecting your XML output from contamination with illegal characters.


Dave

Replies are listed 'Best First'.
Re^2: new file per line output
by AnomalousMonk (Archbishop) on Dec 31, 2013 at 20:52 UTC
    • Have you verified that your pattern matches are successful, or just assuming they are?

    This point is particularly important given that the   m!.*@([^_]*)-! regex of monteryjack's OPed code requires a '-' (hyphen) to be present in the string for a match, and this is nowhere the case in the example data given in the OP.