Seems $1 was reset after every matching.
Correct. The pragma use warnings would tell you:
Use of uninitialized value $1 in substitution iterator at...
which indicates that $1 is undef, because nothing has been captured in the current substitution. Easily fixed by adding parentheses to capture the text you want to keep:
$ou =~ s/^\s*#\s*(PATH=.*\$NAS_DB\/bin.*)$/$1/;
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: regex substitute(resolved)
by Athanasius
in thread regex substitute(resolved)
by anaconda_wly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |