#!/usr/bin/env perl use warnings; use strict; my $inp_row = "per|l|mo|nks|ro|ck|s"; my $de = '|'; my @chars = split //, $inp_row; my $cnt = 0; for (@chars) { $cnt++ if ($_ eq $de) } print "delim is $de count is $cnt\n";
Prints:
delim is | count is 6
In reply to Re: Regex - counting number of '|'
by toolic
in thread Regex - counting number of '|'
by perl_junkie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |