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.


In reply to Re: Run a perl code on all input files and have the results in different output files by Anonymous Monk
in thread Run a perl code on all input files and have the results in different output files by SaraMirabi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.