On 03/13/2017 01:16 AM, Elizabeth Mattijsen wrote:

On 13 Mar 2017, at 08:27, ToddAndMargo <toddandma...@zoho.com> wrote:

Hi All,

What am I doing wrong here?

$ perl6 -e 'my $x="abc\(123\)def"; $x ~~ m/(abc\))(123)(\(def)/; say "$x\n\$0=<$0>  
\$1=<$1>  \$2=<$2>\n";'

Use of Nil in string context
 in block <unit> at -e line 1
Use of Nil in string context
 in block <unit> at -e line 1
Use of Nil in string context
 in block <unit> at -e line 1

abc(123)def
$0=<>  $1=<>  $2=<>

You escaped the parens around (123) incorrectly:

$ 6 'my $x="abc\(123\)def"; $x ~~ m/(abc)\((123)\)(def)/; say "$x\n\$0=<$0>  \$1=<$1>  
\$2=<$2>\n"'
abc(123)def
$0=<abc>  $1=<123>  $2=<def>


Liz


Hi Liz,

Thank you!  I must have been seeing things!

perl6 -e 'my $x="abc\(123\)def"; $x ~~ m/(abc\()(123)(\)def)/; say "$x\n\$0=<$0> \$1=<$1> \$2=<$2>\n";'
abc(123)def

$0=<abc(>  $1=<123>  $2=<)def>


Many thanks,
-T


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to