in reply to Re^2: Parsing email and returning the key/values in two hashes
in thread Parsing email, inserting into database and creating an aggregation report.
Hi 'gator,
If you have a line that is fixed width columns you can unpack it based on the widths quite easily. This gets around all the probs of split and fields that can contain a variable amount of whitespace (I suspect your category field easily could)
# it goes a little like this while (<DATA>) { my ($Name, $Host, $Port, $Rest)=unpack('A15A10A10A*', $_); # now do what you will with them }
the A tells it to unpack ASCII, the numbers are the number of characters in each column, the A* just grabs the rest 'cos I was too lazy to count all your column widths
Festive Cheers,
R.
|
|---|