for my $bn ( @B_CHECKS ) { my $re = qr/^(?:0|5|6)0+\Q$bn\E$/; for my $cn ( @CS_CHECKS ) { if ( $cn =~ $re ) { print "$bn = $cn\n"; } } }