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 variables.
This applies to in
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" control character.
> #check if there is n