use strict; my $abcd = "Hello how r you?"; my $hello="Hello"; $abcd =~ s{\w} { #{ #}{ if ($hello) {"1"} else {"0"} }exgs; print $abcd; #### Substitution replacement not terminated at test.pl line 5. #### use strict; my $abcd = "Hello how r you?"; my $hello="Hello"; $abcd =~ s{\w} { if ($hello) {"1"} else {"0"} }exgs; print $abcd;