I have found the series of articles, eg
http://www.oreillynet.com/pub/a/network/2001/05/18/perl_redflags.html
to be most helpful for such problems
- Roger -
----- Original Message -----
From: "Teresa Raymond" <[EMAIL PROTECTED]>
To: "beginnerperllist" <[EMAIL PROTECTED]>
Sent: Thursday, June 07, 2001 7:23 AM
Subject: More "Succintification"
> How can I get this code to be more readable? Thanks in advance.
>
> #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";
> -Teresa Raymond
> http://www.mariposanet.com
> [EMAIL PROTECTED]
>
>
>