2 ms·
$str = q 7Hello, world.7; whew, I would not want to be in the business of lexing perl > sed also has something similar: I also recently learned that one can
by mdaniel 4y ago
$str = q 7Hello, world.7;
whew, I would not want to be in the business of lexing perl
> sed also has something similar:
I also recently learned that one can do the same in the "pattern match" case (not just with `s`) by using a backslash, as in:
printf 'a/b/c\nd/e/f\n' | sed -ne '\_a/b/c_p'
the man page says "any character" and sure enough, `\ a/b/c p` works also
- wernsey 4y agoSheesh, me neither. How on earth would you create syntax highlighters and other tools for this language?
- yellowapple 4y ago> whew, I would not want to be in the business of lexing perl Hence the saying: the only thing that can parse Perl is Perl :)
- mdaniel 4y agoYour comment made me curious, so I installed the Perl plugin for IJ <https://plugins.jetbrains.com/plugin/7796-perl https://plugins.jetbrains.com/plugin/7796-perl> and sure enough, it parsed that str assignment correctly. My hat's off to them! It also seems <https://github.com/Camelcade/Perl5-IDEA/blob/2023.1.1/plugin/core/grammar/Perl.flex#L353-L358 https://github.com/Camelcade/Perl5-IDEA/blob/2023.1.1/plugin...> that one can have line comments in there, too my $str = q #what is happening here 7Hello, world.7;