Moon, John wrote:
> I have the follows code
> perl -e '
> @a=(q{a...x name=taga_1 #...d name=tagb_1 f...r name=tagc_1 xxnn},
> q{h...e name=taga_4 t...g name=tagb_4 k name=tagc_4 nn});
> $ndx = 0;
> foreach $ln (@a) { 
>       print "b4 = $ln\n";
>       $ln =~s/(name=.*)\d+/\1$ndx/g;

You should use $1 instead of \1 in the string half of the substitution and .*
is greedy so should make it non-greedy.

        $ln =~s/(name=.*?)\d+/$1$ndx/g;


>       print "af = $ln\n";
>       $ndx++
>       }'


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to