SaraMirabi has asked for the wisdom of the Perl Monks concerning the following question:
I am decoding my TAPs with Tap3edit. I introduce my input file in the Perl code and have the decoded file as an output. Now I have about 200 files I want my Perl code decode them automatically and save them as different outputs with the same name in XML. I found glob and basename for finding my specific file names in which their name starts with DA and then start to decode but in the result, it seems only the first file has been decoded. I really appreciate it if anyone can help me. I apologize if it too basic, cause I am so new with Perl.
#!/usr/bin/perl -w use strict; use warnings; use Data::Dumper; use XML::Dumper; use TAP3::Tap3edit; $Data::Dumper::Indent=1; $Data::Dumper::Useqq=1; my $dump = new XML::Dumper; use File::Basename; my $perl=''; my $xml=''; my $tap3 = TAP3::Tap3edit->new(); foreach my $file(glob 'Taps/X*') { $files= basename($file); $tap3->decode($files) || die $tap3->error; } my $filename="Out.xml"; $perl = $tap3->structure; $dump->pl2xml($perl, $filename); print "Done \n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Run a perl code on all input files and have the results in different output files
by bliako (Abbot) on May 12, 2020 at 08:54 UTC | |
by SaraMirabi (Novice) on May 12, 2020 at 09:02 UTC | |
by bliako (Abbot) on May 12, 2020 at 09:40 UTC | |
Re: Run a perl code on all input files and have the results in different output files
by Anonymous Monk on May 12, 2020 at 13:17 UTC |