develooper Front page | perl.perl5.porters | Postings from June 2021

Re: qr'$foo' and unescaped $ signs

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
June 30, 2021 12:22
Subject:
Re: qr'$foo' and unescaped $ signs
Message ID:
20210630122216.GJ11066@etla.org
On Wed, Jun 30, 2021 at 06:18:13AM -0600, Karl Williamson wrote:

> $ blead -Dr -le "qr'$foo'm"
> Compiling REx ""
> Final program:
>    1: NOTHING (2)
>    2: END (0)
> minlen 0
> Enabling $` $& $' support (0x7).

I think that your Unix shell quoting is not doing you favours here.

I think that for this examples the shell will replace $foo with an empty
string, as the shell is processing the "" quotes. So you perl one-liner
is not what you intended. (I believe).

And in the other, \$ is processed by the shell, not perl's parser.

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About