--- Teresa Raymond <[EMAIL PROTECTED]> wrote:
> How can we make this code more succinct?

A quick run through perltidy adds some whitespace:
====================================================
#LOOP TO INITIALIZE VARIABLES + TEST N COMMANDS FOR MATCH IS YES
foreach $i( sort(@indata) ) {
    chop($i);
    (
      $aptname,  $address, $city,     $zip,     $phone,   $location,
      $bedrooms, $rentmin, $ren tmax, $pets,    $laundry, $garage,
      $comment,  $aptweb,  $aptemail, $graphic )
      = split ( /\|/, $i );
    if ( ( $in{'location'} eq "All" || $location =~ /$in{'location'}/ig
)
      && ( $in{'bedrooms'} eq "Any" || $bedrooms =~ /$in{'bedrooms'}/ig
      || ( $in{'bedrooms'} eq "4 plus Bedrooms"
      && ( $bedrooms =~ /4 Bedrooms/ig || $bedrooms =~ /5 Bedrooms/ig
      || $bedrooms =~ /6 Bedrooms/ig ) ) )
      && ( $rentmin <= $in{'rentmax'} && $rentmax >= $in{'rentmin'} )
      && ( $pets =~ /$in{'pets'}/ig || $in{'pets'} eq "Doesn't Matter"
      || ( $in{'pets'} =~ /yes/ig
      && ( $pets =~ /Cats/ig || $pets =~ /Some Units/ig ) ) )
      && ( $laundry =~ /$in{'laundry'}/ig || $in{'laundry'} eq "Doesn't
  Matter" || ( $in{'laundry'} =~ /yes/ig && $laundry =~ /Some Units/ig
) )
      && ( $garage =~ /$in{'garage'}/ig || $in{'garage'} eq "Doesn't
Matter"
      || ( $in{'garage'} =~ /yes/ig && $garage =~ /Some Units/ig ) ) )
    {
        $match = "yes";
        print "<tr><td rowspan=\"5\"><img
src=\"$url/aptimages/$graphic\" 
height=\"150\" width=\"150\" hspace=\"10\" alt=\"Apartment 
  Graphic\"><td colspan=\"2\"><br></td></tr>\n";
        print "<tr><td colspan=\"2\"><b><i>Result</i></b>: ",
$apartment++,
          "</td></tr>\n";
        print "<tr><td><a 
href=\"http:/$aptweb\">$aptname</a><br>$address<br>$city 
$zip<br>$phone<br><a 
href=\"$url$urlcgi/aptemailhtml.cgi?aptemail=$aptemail&aptname=$aptnam 
e&phone=$phone\">Contact Us</a></td><td width=\"350\" 
valign=\"top\"><i><b>Rent</b></i>: $rentmin to 
  $rentmax<br><i><b>Bedrooms</b></i>: $bedrooms</td>\n";
        print "</tr>\n";
        print "<tr><td><b><i>Pets:</i></b> $pets 
<b><i>Laundry:</i></b> 
  $laundry  <b><i>Garage:</i></b> $garage</td><td><br></td>\n";
        print "</tr>\n";
        print "<tr><td><b><i>Hyde Park Location:</i></b> 
  $location</td><td><br></td>\n";
        print "</tr>";
        print "<tr><td
colspan=\"2\"><b><i>Comments:</i></b>$comment</td>\n";
        print "</tr>\n";
    }
}
print "</table>\n";
====================================================

I'd format it differently, but this was quick and easy.

I'd still agree that the best suggestion I've seen is to use CGI.pm and
some here-docs like

  print <<END;

     Now all this is formatted HTML. Tags, whatever.

END


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Reply via email to