|
print CountMatch("bc","|") . "\n";
print CountMatch("|bc","|") . "\n";
print CountMatch("|||c","|") . "\n";
print CountMatch("|||||bc","|") . "\n";
sub CountMatch()
{
$s_string = shift;
$count=0;
while ($s_string =~ s/^\|//g) { $count++ }
return $count;
}
|
|