Rob Dixon wrote:
> David Gilden wrote:
>> How do get  $i do increment inside the substitution below?
>> Thanks
>> Dave
>>
>> #!/usr/bin/perl -w
>>
>> my $i = 0;
>>
>> while(<>) {
>>     chomp;
>>     s/name=\"order/name=\"order$i++/;
>>     print "$_\n";
>> }
>
> Hi David.
>
> You can use the /e (for Expression) modifier on the substitution
> to evaluate a replacement expression each time.
>
>     s/name="order/name="order$i++/e;

Wrong - sorry! Try:

    $s =~ s/name="order/$i++, qq(name="order$i)/e;

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to