Re: Quotes for value of <skip:> directive.
[email protected] (Damian Conway)
| Newsgroups | perl.recdescent |
|---|---|
| Message-ID | <[email protected]> |
Carl asks:
> This script works great. However, if I change the value of the skip
> directive so that it uses double quotes instead of single quotes:
>
> <skip: "\.*">
>
> the grammar fails to parse the input. However, if I put square
> brackets around the escaped dot:
>
> <skip: "[\.]*">
>
> the grammar starts working again:
>
> How does this work this way?
This small test program may help you figure out what's going wrong:
print "\.*", "\n";
print '\.*', "\n";
Backslash works differently inside single and double quotes.
Try:
<skip: "\\.*">
The reason the third variant:
<skip: "[\.]*">
works is because it becomes the pattern:
/[.]/
which is a literal dot.
Damian