Change default regexp behavior in Perl?



Is there some global option available in Perl which specifies the default behavior regexp match behavior? Like ignore case by default even without i option match operator.


You may be looking for re pragma

use re '/ix';  
"FOO" =~ / foo /; # /ix implied  
no re '/x';  
"FOO" =~ /foo/;   # just /i implied

Answered By – zdim

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More