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)$/;