Your code is hard to read, and I only say hard because I gave up too early to end up saying impossible.

If you have too many variables with names ending with a number, there's probably a design problem. In your case that's already obvious with the files. Either all three of them have the same role, and one can be used as the other without the whole program losing all its sense, and you can store their name and filehandles in an array or whatever data structure seems the best. Or your files have different purposes and you should give them names accordingly.

The same goes for arrays, you can't have 8 of them called "array" and use them for 8 different purposes.

As a rule, you should try to name your things by what they mean and not what they do. An array of colour names should be @colour, not @array. And how the hex do you end up with more than one kind of nothing?

And Perl warns you for a reason, because code that seems to work but has unexpected behaviour is actually worse than code that doesn't work but explicitly fails. So the first optimisation is use warnings


In reply to Re: Searching for two elements in two different lines by Eily
in thread Searching for two elements in two different lines by noob_mas

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.