Scripting >> Perl >> How to use the pattern match operator m//



m/PATTERN/cgimosx
/PATTERN/cgimosx
 
     Searches a string for a pattern match, and in scalar context
     returns true (1) or false (''). If no string is specified via
     the =~ or !~ operator, the $_ string is searched. (The string
     specified with =~ need not be an lvalue--it may be the result
     of an expression evaluation, but remember the =~ binds rather
     tightly.) See also perlre. See perllocale for discussion of
     additional considerations that apply when uthe se locale is in
     effect.  
 
     Options are:  
 
     c   Do not reset search position on a failed match when /g
         is in effect.
     g   Match globally, i.e., find all occurrences.
     i   Do case-insensitive pattern matching.
     m   Treat string as multiple lines.
     o   Compile pattern only once.
     s   Treat string as single line.
     x   Use extended regular expressions.

     If string not assigned to $_ then use string =~ /<pattern>/opt
     For details see man perlop.