Re: incrementing inside a s///

2003-02-12 Thread Rob Dixon
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"; >>> }

Re: incrementing inside a s///

2003-02-11 Thread Jenda Krynicky
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

Re: incrementing inside a s///

2003-02-11 Thread John W. Krahn
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

Re: incrementing inside a s///

2003-02-11 Thread Rob Dixon
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

Re: incrementing inside a s///

2003-02-11 Thread Rob Dixon
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

Re: incrementing inside a s///

2003-02-11 Thread Jenda Krynicky
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

incrementing inside a s///

2003-02-11 Thread David Gilden
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