in reply to Tracking consecutive characters

$_ = 'Wow!!!!!'; /(!{2,})/ and print length $1; __END__ 5
The curlies make a quantifier meaning two or more.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: Tracking consecutive characters
by ikegami (Patriarch) on Sep 27, 2004 at 03:56 UTC

    Here are variants that matches multiple times:

    $_ = 'Wow!!!!! simply wow!!!'; @lengths = map { length } /(!{2,})/g;

    or

    $_ = 'Wow!!!!! simply wow!!!'; push(@lengths, length($1)) while (/(!{2,})/g);

      And if you just want to know the maximum string of consecutive !

      $max = ( sort {$b<=>$a} map{length} /(!{2,})/g )[0];