in reply to rfc: logging changes per file from subroutines

If I've understood you correctly, your problem seems to be that you've decided to log to a CSV file. So it must have a fixed column order -- the only suggestion I can make is don't do that, then :)

Most logs are free format text, but if you want to process them later you could identify each item, so something like

file:testfile.xml, id:42, note:"it all gone wrong" file:test3.xml, DEVTYPE:SW, cid:42a, note:"bingo"

So removing the need to have the items in any particular order and it's simple to load each line into a hash

Replies are listed 'Best First'.
Re^2: rfc: logging changes per file from subroutines
by Lotus1 (Vicar) on Nov 09, 2011 at 19:30 UTC

    I need csv format so I can make sense of what happened by sorting and browsing in Excel. There are usually 5000-10,000 rows but a hopefully small number of problems.

    From your suggestion I could log free format and then at the end sort each line of the logfile into the desired order.

    I'm already loading each data point into a hash and then using a subroutine to print the hash in order. Since I already have a hash I don't see how that would help.