Introduction to Regexes
- =~
- !~
- //
my $str = "Some string here";
if ($str =~ /m/) {
print "There is a match\n";
}
if ($str !~ /a/) {
print "No match\n";
}
# which is the same as
if (not $str =~ /a/) {
print "No match\n";
}
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
my $str = "Some string here";
if ($str =~ /m/) {
print "There is a match\n";
}
if ($str !~ /a/) {
print "No match\n";
}
# which is the same as
if (not $str =~ /a/) {
print "No match\n";
}