Jenda Krynicky wrote:
> From: "John W. Krahn" <[EMAIL PROTECTED]>
>> David Gilden wrote:
>>>
>>> How do get $i do increment inside the substitution below?
>>>
>>> #!/usr/bin/perl -w
>>>
>>> my $i = 0;
>>>
>>> while(<>)
>>> {
>>> chomp;
>>> s/name=\"order/name=\"order$i++/;
>>> print "$_\n";
>>> }
From: "John W. Krahn" <[EMAIL PROTECTED]>
> David Gilden wrote:
> >
> > How do get $i do increment inside the substitution below?
> >
> > #!/usr/bin/perl -w
> >
> > my $i = 0;
> >
> > while(<>)
> > {
> > chomp;
> > s/name=\"order/name=\"order$i++/;
> > print "$_\n";
> > }
>
> Another way to d
David Gilden wrote:
>
> How do get $i do increment inside the substitution below?
>
> #!/usr/bin/perl -w
>
> my $i = 0;
>
> while(<>)
> {
> chomp;
> s/name=\"order/name=\"order$i++/;
> print "$_\n";
> }
Another way to do it:
s/name="order/name="order@{[$i++]}/;
John
--
use Perl;
program
f
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 (f
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 substit
From: David Gilden <[EMAIL PROTECTED]>
> 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";
>
> }
You have to tell Perl to treat the replacement as Perl
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";
}
==
Cora Connection: Your West African Music Source