The result of the expression |
$string =~ m/$regex/ |
is true if and only if the value of $string matches $regex. |
For example, |
if ( <STDIN> =~ m/^[Tt][Oo]:/ ) { ... } |
matches if current input line starts with to: (any case) |
Note: m/^to:/i is equivalent to above expression since modifier /i instructs pattern matcher to ignore case |
Any delimiter may be used in place of the slash |
m%^[Tt][Oo]:% # equivalent to previous expression |
The m operator may be omitted, but then slash delimiters are required |