Journal JazzHarper's Journal: A Perl Lesson for the Day 1
If you have a block of quoted text inside the
single-quoting operator q(), a
backslash preceding a '(' or ')' (or whatever
delimiter characters you have chosen for
q()), will be parsed as an escape on that delimiter character. Therefore, you
must escape any literal backslash if it appears before '(' or ')'.
Example:
#!/usr/bin/perl -w
print q(
This is a test... x(1), x\(2\), x\[3\], x\\(4\\).
);
The rationale for this undocumented Perl feature is reasonable. The q() operator will ignore balanced pairs of delimiter characters that appear in the enclosed text, but it is sometimes necessary to write text that contains unbalanced delimiters. To make that possible, the q() operator must recognize the escape on its delimiters.
Pedal-free Harp? (Score:1)