Dear Monks,
I am trying to execute the code given below.
use strict;
my $abcd = "Hello how r you?";
my $hello="Hello";
$abcd =~ s{\w}
{
#{
#}{
if ($hello)
{"1"}
else
{"0"}
}exgs;
print $abcd;
It is giving me error
Substitution replacement not terminated at test.pl line 5.
When I removed line 6 & 7 the code looked as below
use strict;
my $abcd = "Hello how r you?";
my $hello="Hello";
$abcd =~ s{\w}
{
if ($hello)
{"1"}
else
{"0"}
}exgs;
print $abcd;
It works proper and gives me output
11111 111 1 111?
My question is, why the commented braces are playing role in this error ? Have I done something wrong here?