getting rid of all them leaning toothpicks
Another way to eliminate the leaning toothpicks is to single-quote the non-interpolating part of the replacement string before making the replacement:
my $rep = '$cTestH{$dbFile}{$timeRng}{$regionName}{'; my $bool = 'A&!B&!C'; $bool =~ s/([a-zA-Z]\w*)/$rep$1}/g;
Output:
12:55 >perl 1560_SoPW.pl Evaluating Test Condition: $cTestH{$dbFile}{$timeRng}{$regionName}{A}& +!$cTestH{$dbFile}{$timeRng}{$regionName}{B}&!$cTestH{$dbFile}{$timeRn +g}{$regionName}{C}... Result is: 1 12:55 >
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re^2: Perl Boolean Evaluation Shows Incorrect Results
by Athanasius
in thread Perl Boolean Evaluation Shows Incorrect Results
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |