my %tollfree = map { $_ => 1 } 800, 866, 877, 888; if ( $line !~ m/^2/ || !$tollfree{ substr($line, 14, 3) } ) { ... }