for ( 'A_TAG_HSSL_LBA_1', 'A_TAG_HSSL_LBAB_1' ) { if( ! /A_[A_Z0-9_]+/i) { print "$_ is not matching\n"; } else { print "$_ matches\n"; } }