in reply to printing column info without headers
oruse DataExtract::FixedWidth; use IO::File; use feature ':5.10'; my $fh = IO::File->new( 'file.txt', 'r' ); my @tuples = <$fh>; my $de = DataExtract::FixedWidth->new({ heuristic => \@tuples }); foreach my $tuple ( @tuples ) { state $row; my $arr = $de->parse( $tuple ); given ( ++$row ) { when ( 1 ) { say $arr->[0] } when ( 2 ) { say $arr->[2] } } }
my $de = DataExtract::FixedWidth->new({ heuristic => \@tuples , column_names => [qw/foo bar baz/] }); foreach my $tuple ( @tuples ) { state $row; my $hash = $de->parse_hash( $tuple ); given ( ++$row ) { when ( 1 ) { say $hash->{foo} } when ( 2 ) { say $hash->{baz} } } }
|
|---|