Re: replace char n times

2001-12-03 Thread Jeff 'japhy' Pinyan
On Dec 4, Hasanuddin Tamir said: >Taken from perlfaq4, > >s/(_)/++$c <= $count ? '' : $1/ge; Hrm, why not: s/(_)/++$c > $count && $1/ge; since it's DOCUMENTED that > returns '' for false. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother

Re: replace char n times

2001-12-03 Thread Hasanuddin Tamir
On Mon, 3 Dec 2001, Mark Hanson <[EMAIL PROTECTED]> wrote, > Hi gurus! > > I want to use the quantifier {COUNT}? in the following program to remove the first >three underscores. I'm trying to avoid a loop. I have not been able to figure out the >syntax. > > $a = "The_quick_brown_fox_jumped_ov

replace char n times

2001-12-03 Thread Mark Hanson
Hi gurus! I want to use the quantifier {COUNT}? in the following program to remove the first three underscores. I'm trying to avoid a loop. I have not been able to figure out the syntax. $a = "The_quick_brown_fox_jumped_over_the_lazy_dog."; $count = "3"; $a =~ s/(_{$count}?)//; print "\n$a\n