M
Marv
Hello,
How would you write 'does not match' in a regex match?
Below is what I was assuming would work, but it doesn't. I guess you
cannot use "!=~" for does not match. What can you use here?
#!/usr/bin/perl
$var1="test";
$var2 = "testing";
if ($var2 !=~ m/$var1/){
printf "Doesn't match\n";
} else {
printf "Does match\n";
}
Thanks,
Max
How would you write 'does not match' in a regex match?
Below is what I was assuming would work, but it doesn't. I guess you
cannot use "!=~" for does not match. What can you use here?
#!/usr/bin/perl
$var1="test";
$var2 = "testing";
if ($var2 !=~ m/$var1/){
printf "Doesn't match\n";
} else {
printf "Does match\n";
}
Thanks,
Max