in reply to convert a comma delimited file to a fixed length
If you don't like SQL, the AnyData module will let you do the same thing with a tied-hash interface.#!/usr/bin/perl -w use strict; use DBI; my $pattern = {pattern=>'A6 A9 A8 A5 A3'}; # widths of cols my $dbh=DBI->connect('dbi:AnyData(RaiseError=1):'); $dbh->ad_catalog('T1','CSV','yourfile.csv'); $dbh->ad_catalog('T2','Fixed','yourfile.fix',$pattern); $dbh->do("CREATE TABLE T2 AS SELECT * FROM T1"); __END__
|
|---|