in reply to Commented braces in Code
006: #{
007: #}{
Note also that the problem version runs correctly when written with slashes rather than curly braces:
use strict; my $abcd = "Hello how r you?"; my $hello="Hello"; $abcd =~ s/\w/ #{ #}{ if ($hello) {"1"} else {"0"} /exgs; print "$abcd \n";
Output: 11111 111 1 111?
The capability of using alternatives to slashes in regexen is, at least as I understand it, to make the notation more readable. For me, at least, your use of curly braces makes it more difficult to read, particularly given their use for a quite different purpose within the substitution.
|
|---|