- publishing free software manuals
Perl Language Reference Manual
by Larry Wall and others
Paperback (6"x9"), 724 pages
ISBN 9781906966027
RRP £29.95 ($39.95)

Sales of this book support The Perl Foundation! Get a printed copy>>>

\\N{NAME} must be resolved by the lexer

(F) When compiling a regex pattern, an unresolved named character or sequence was encountered. This can happen in any of several ways that bypass the lexer, such as using single-quotish context, or an extra backslash in double quotish:

$re = '\N{SPACE}';  # Wrong!
$re = "\\N{SPACE}"; # Wrong!
/$re/;

Instead, use double-quotes with a single backslash:

$re = "\N{SPACE}";  # ok
/$re/;

The lexer can be bypassed as well by creating the pattern from smaller components:

$re = '\N';
/${re}{SPACE}/;     # Wrong!

It's not a good idea to split a construct in the middle like this, and it doesn't work here. Instead use the solution above.

Finally, the message also can happen under the /x regex modifier when the \N is separated by spaces from the {, in which case, remove the spaces.

/\N {SPACE}/x;      # Wrong!
/\N{SPACE}/x;       # ok
ISBN 9781906966027Perl Language Reference ManualSee the print edition