in reply to Re: Regex - counting number of '|'
in thread Regex - counting number of '|'

my @chars = split //, $inp_row; my $cnt = 0; for (@chars) { $cnt++ if ($_ eq $de) }

You could eliminate the array, for loop and conditional increment by using grep.

my $cnt = grep { $_ eq $de } split m{}, $inp_row;

I hope this is of interest.

Cheers,

JohnGG