FreeKB - Regular expression delimiter in Perl
Regular expression delimiter in Perl

Home > Search

By default, the forward slash character is used to separate fields in regular expressions in Perl.

if ($foo =~ /hello/) { print "foo contains hello"; }


Using the m character, you can use a different character to separate fields in a regular expression. In this example, m is used and # is set as the delimiter.

if ($foo =~ m#hello#) { print "foo contains hello"; }


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter 770b8 in the box below so that we can be sure you are a human.