[Omaha.pm] Code reduction

Jay Hannah jay at jays.net
Thu May 17 12:43:23 PDT 2007


Confession: This isn't really Perl specific, just a general logic / 
cleanup excercise.

j


Before:

next if ((not $row[20] =~ /^PENDING/) and (not $row[20] =~ /^ACTIVE/)); #get rid of all rows not pending
# next if (not $row[20] =~ /^PENDING/); #get rid of all rows not pending
next if ($row[19] =~ /^ON-CALL/);

After:

next unless ($row[20] =~ /^(PENDING|ACTIVE)$/;




More information about the Omaha-pm mailing list