This is much better, Nik. You need to learn about placeholders, but your code and your question are better then previous efforts.

However, you are not using strict or, if you are, you are neutering it by having a huge my() or use vars() at the top. Had you been using strict, the bug trammell noticed would have been noticed for you by perl itself. That's why we have been telling you over and over to use it. Warnings would also help find other bugs you have.

As for your UTF-8, the better thing to do would be to create a sample script that only uses ASCII and demonstrates the question you have. Post that, then take the answers given and apply them to your real script.

As for your logic - I don't know what $data does. I also don't know why you're checking the 'select' parameter from your form before caring if the $hostmatch variable is 1 or not 1. Your specifications are unclear.


The Perfect is the Enemy of the Good.


In reply to Re: Is this logic correct? Maybe can be rewritten better? by dragonchild
in thread Is this logic correct? Maybe can be rewritten better? by Nik

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.