Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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 ( #11116712=note: print w/replies, xml ) Need Help??

in reply to Run a perl code on all input files and have the results in different output files

What you really need is someone with experience of the specific Perl modules, which I do not have.

I did read the source of Tap3::Tap3edit though, and it looks to me like the decode() method replaces whatever was there before.

Of course, this means that at the end of the loop it would be the last file left in the $tap3 object, not the first. So something else must also be going on.

I also reiterate a previous poster's question of the use of basename(). As your code is written, the glob() finds all files named X* in directory Taps/ under your current directory. But by feeding decode() the basename of the file you find you are actually attempting to read a file in your current directory, not in Taps/. Now, you are checking the status of the operation, and though in general your check is subtly wrong (your habit should be to use ... or die ... rather than ... || die ...), in this specific case I do not think that the tighter binding of || versus or invalidates the test.

Given all this, I believe that if I were in your position I would dump the contents of $file, $files, and any relevant information about the parse immediately after the call to decode() and see if it was what I expected. Maybe initially put die 'Debugging'; after the dump so that you are only dealing with one mass of information at a time, instead of a whole directories' worth.

Irrelevantly to your question, I would like to note that for a self-confessed newbie you are doing basic things right. Using use strict; and use warnings; will spare you grief now and in the future.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11116712]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2021-05-07 15:51 GMT
Find Nodes?
    Voting Booth?
    Perl 7 will be out ...

    Results (92 votes). Check out past polls.