On Mon, Jan 12, 2009 at 1:08 PM, Larry Wall <la...@wall.org> wrote:
> On Mon, Jan 12, 2009 at 03:43:47AM -0800, Jon Lang wrote:
> : On Mon, Jan 12, 2009 at 2:15 AM, Carl Mäsak <cma...@gmail.com> wrote:
> : > Ovid (>):
> : >>  $ perl6 -e 'my $foo = "foo";say "{" ~ $foo ~ "}"'
> : >>   ~ foo ~
> : >
> : > Easy solution: only use double quotes when you want to interpolate. :)
> : >
> : > This is not really an option when running 'perl6 -e' under bash, though.
> :
> : $ perl6 -e 'my $foo = "foo";say q:qq({" ~ $foo ~ "})'
> :
> : ...or something to that effect.
>
> Assuming that's what was wanted.  I figgered they want something more
> like:
>
>    $ perl6 -e 'my $foo = "foo"; say q[{] ~ $foo ~ q[}];'

True enough.  Either one of these would be more clear than the
original example in terms of user intent.

As well, isn't there a way to escape a character that would otherwise
be interpolated?  If the intent were as you suppose, the original
could be rewritten as:

  $ perl6 -e 'my $foo = "foo";say "\{" ~ $foo ~ "}"'

(Or would you need to escape the closing curly brace as well as the
opening one?)

-- 
Jonathan "Dataweaver" Lang

Reply via email to