in reply to Increase number per regex replacement
$i = 0; @no = qw(one two three four five); foreach ( @no ){ s/e/foo.$i/ && $i++ while /e/; } print "@no\n"; __END__ onfoo.0 two thrfoo.1foo.2 four fivfoo.3
--
perl -pe "s/\b;([st])/'\1/mg"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Increase number per regex replacement
by blakem (Monsignor) on Jan 08, 2002 at 10:46 UTC | |
by belg4mit (Prior) on Jan 08, 2002 at 11:02 UTC | |
by blakem (Monsignor) on Jan 08, 2002 at 11:34 UTC |