That's not quite what it does. $cgi->param returns a list of the names of all the form fields submitted by the browser. So if any are submitted, it will return true, regardless of their values. Only when the URI is requested without any POST data -- as when the page is first loaded, typically -- will it return nothing, giving a false status to the if statement. So it's not really "checking all the parameters." To the extent that it loads them into some sort of structure, I'm fairly sure that was already done when you created the CGI object, so there's not much cost here.

On your last question: If you have forms with that many fields, I think you'll run into bottlenecks at the browser or the web server -- with the maximum POST data size, for instance -- long before counting the items in a large array slows down your Perl script. With a form that large, I'd be more concerned about usability and maintainability than with speed.

Aaron B.
My Woefully Neglected Blog, where I occasionally mention Perl.


In reply to Re^3: Web form to alter files is writing to file before submit button is pressed. by aaron_baugher
in thread Web form to alter files is writing to file before submit button is pressed. by Lady_Aleena

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.