in reply to Perl record types
If all you want is to assign names to columns the type could be as easy as:
Where I use a package variable to indicate that @Columns etc are "global" and so that it can be accessed when that code is loaded from another file / package.my $c = 0; our @Columns = qw(field1 field2 ...); our %Column_numbers = map { $_ => $c++ } @Columns;
Any utility subs (like parsing the input file) can go in the same module, so they can be re-used.
As for existing CPAN modules, you should be aware that you can generally install perl modules locally (i.e. in a sub directory of your choice, so no root permissions necessary), That also usually means you can distribute them with the rest of the program tree without any issues. The most common drawback is that this won't work for XS/C based modules across architectures.
Text::CSV and Text::xSV can take some work out of your hands for this specific problem.
|
|---|