Fastolfe is, as usual, correct about putting the files into a loop.

To delve further into what Kanji was saying, you can avoid the object-oriented syntax (which is unnecessary here) by putting

use CGI qw/:cgi/;
at the top of your code. I'd avoid using all the temporary variables ('$virtual_tour' etc.) if I were you. There's no harm in using param('xxx') every time you want a variable, and every needless temporary variable adds to the confusion factor of your code ("Have I initialized $virtual_tour yet? Where?"). If you need to interpolate the variables into a string, you can use:
print STDOUT "The tax year is @{[ param('TAX_YEAR') ]}";
Or, better,
print STDOUT "The tax year is ", param('TAX_YEAR');
The only drawback of using 'param' all over the place is the possibility of misspelling some parameter names, which won't be detected by perl, even with '-w'. If this is a problem, you can define your parameter names as constants like so:
use constant DOWNPAYMENT => 'DOWNPAYMENT';
That might be overkill, but offers the advantage of having all of your parameter names in a single place. Then you can say:
print STDOUT "Downpayment is: ", param(DOWNPAYMENT);
but misspelling would give a compile-time error if you 'use strict' and -w (and you are, of course, yes? :) )
# Gives an error print STDOUT "Downpayment is: ", param(DOWNPAMENT);
Best of luck...

stephen


In reply to Re: Simplifying the following code by stephen
in thread Simplifying the following code by Stamp_Guy

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.