in reply to Re: Extract information from several files in directory
in thread Extract information from several files in directory
If you start simple, Text::CSV_XS' interface does not have a steep learning curve at all :)
If all your text files have a header, and you want "column" fooble extracted from all TAB-separated .txt files
use strict; use warnings; use Text::CSV_XS qw( csv ); my @result; foreach my $f (sort glob "*.txt") { # Use File::Find for recursive act +ions csv (in => $f, headers => "auto", sep => "\t", on_in => sub { push @result => $_{fooble}; }); } open my $fh, ">", "results.txt" or die $!; say $fh $_ for grep { length } @result; close $fh;
Enjoy, Have FUN! H.Merijn
|
---|
In Section
Seekers of Perl Wisdom