$NetPattern = qr{mbist[\w+\d+\/]*\[\d+\]}x; if ($NetName =~ $NetPattern) {# Do fantastical things...} #### $NetPattern = 'mbist[\w+\d+\/]*\[\d+\]'; if ($NetName =~ qr/$NetPattern/x) {# Do fantastical things...} #### $NetPattern = 'mbist[\w+\d+\/]*\[\d+\]'; if ($NetName =~ m/$NetPattern/x) {# Do fantastical things...}