in reply to Re: Evaluating a regex replacement value
in thread Evaluating a regex replacement value
To be ($1 != 0)? ($value * $1) : $value like prasadbabu had it, or really it can just be boiled down to:my $dum=$1; my $val; if ($dum) { $val = $value * $dum }else{ $val=$val +ue} $val
(Assuming that $value is alway numeric) No need for a temp variable or the explicit if/else.$value * ($1 || 1)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Evaluating a regex replacement value
by McDarren (Abbot) on Oct 05, 2005 at 14:09 UTC |