Kal87 has asked for the wisdom of the Perl Monks concerning the following question:
I expect thousands of lines in filename_list.txt I'm looking to update the script so that it reads each line of filename_list.txt, and executes the twig and CSV bit for each file. Not sure how to get this going, could someone please help? I've attempted to use another bash script with a while, but it would be great if someone could suggest a faster method that involves just this perl script./home/kal/assemble.xml /home/tom/Venice.xml
use Text::CSV_XS; use XML::Twig; my $csv = Text::CSV_XS->new({'sep_char' => "|",}, ); my $twig = XML::Twig->new( ); twig_handlers => {'EDI_DC40' => \&process_EDI_DC40,}, ); $twig->parsefile( $ARGV[0] ); sub process_EDI_DC40 { my( $twig, $thingy ) = @_; my @values = map { $thingy->first_child( $_ )->text } qw(DOCNUM MESTYP SNDPRN RCVPOR RCVPRN); $csv->say( *STDOUT, \@values ); + }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to read a file containing filenames and pass as input to perl script?
by choroba (Cardinal) on Apr 18, 2018 at 20:51 UTC | |
by Kal87 (Novice) on Apr 20, 2018 at 12:34 UTC | |
by choroba (Cardinal) on Apr 20, 2018 at 12:59 UTC | |
by Kal87 (Novice) on Apr 23, 2018 at 14:20 UTC | |
by hippo (Archbishop) on Apr 23, 2018 at 14:47 UTC | |
by poj (Abbot) on Apr 23, 2018 at 15:20 UTC | |
|