Ok, this script I am working on allows people to choose 5 different names in drop down menus (one name per drop down menu).. so I have 5 drop down menus with the same list of names and I am saving them into an array like this:
@names = ($INPUT{'name1'},$INPUT{'name2'},$INPUT{'name3'}, $INPUT{'name4'},$INPUT{'name5'});
Ok, what I don't want people to be able to choose the same name twice or three times, or so on. So is there a quick way to compare all the names, see if any are equal, and return an error? I am still learning Perl, so the only way I know how to do this is like so
if ($INPUT{'name1'} eq $INPUT{'name2'}) { $error = 'duplicate vote'; &error; }
But this method would take up a lot of space by making each comparison one at a time... so is there an easier way??? Thanks in advance if you can help me :)

In reply to Question about comparing data values.. by Anonymous Monk

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.