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_over_the_lazy_dog."; > $count = "3"; > > $a =~ s/(_{$count}?)//; > > print "\n$a\n";
Taken from perlfaq4, s/(_)/++$c <= $count ? '' : $1/ge; san -- Trabas - http://www.trabas.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]