Re: constant in regular expression

2008-07-14 Thread Brad Baxter
William wrote: Hello, what is the syntax for having constant in regular expression ? Such as use constant (NL => '\n'); #check if there is newline in the text my $txt = "foo \n bar"; if($txt =~ m/ # ??? /x) { } Constants cannot be interpolated into strings like var

Re: constant in regular expression

2008-07-14 Thread Rob Dixon
William wrote: > Hello, what is the syntax for having constant in regular expression ? Such as > > use constant (NL => '\n'); You know this will create NL as a two-character string - backslash and 'N' - right? You need double quotes if you want the "\n"

constant in regular expression

2008-07-14 Thread William
Hello, what is the syntax for having constant in regular expression ? Such as use constant (NL => '\n'); #check if there is newline in the text my $txt = "foo \n bar"; if($txt =~ m/ # ??? /x) { } Thanks. Send instant messages to your online friends http://uk.mes