- or download this
$str = '( (1 == 1) and (2 < 1) ) or (2 > 0)';
while ($str =~ s/(\([^()]+\))/$1/ee) {
...
last;
}
}
- or download this
$str = '( (1 == 1) and (2 < 1) ) or (2 > 0)';
while ($str =~ s/(\([^()]+\))/qq($1 || 0)/ee) {
print eval($1) ? 'ok' : 'error';
print ": $1\n";
}
- or download this
ok: (1 == 1)
error: (2 < 1)
error: ( 1 and 0 )
ok: (2 > 0)
- or download this
$str = '( (1 == 1) or (2 < 1) ) and (2 > 0)';