I want to check that a string matches multiple regex patterns. I came across a question that Brad Gilbert answered using the smartmatch operator:
my @matches = (
qr/.*\.so$/,
qr/.*_mdb\.v$/,
qr/.*daidir/,
qr/\.__solver_cache__/,
qr/csrc/,
qr/csrc\.vmc/,
qr/gensimv/,
);
if( $_ ~~ @matches ){
...
}
An operator ifis entered if any of the patterns matches, but I want to check if all patterns match. How can i do this?
source
share