in reply to Re: Unpack or substr to create CSV?
in thread Unpack or substr to create CSV?
Not to mention that it's really easy to add data validation with this approach:
use strict; use warnings; while(<DATA>){ s/\A(.)(.{15})(.{14})(.{13})\Z/$1,$2,$3,$4/ or die "bad record: '$_'"; print; } __DATA__ 0123456789012345678901234567890123456789012 C4432882490H019000020150211ESL6690 0H2015PC C4833076550HC0P0000201412093J46651 0H2015DX C6033106980H057130020150323FRE7602 0H2015PC C663160140MT007015G20141124274847A MT2015PC
|
|---|