http://qs321.pair.com?node_id=359816

INSPECT WS-CUSTOMER TALLYING WS-TALLY-COUNT FOR ALL 'JOHN'.
The above COBOL is equivalent to Perl
my $count = $customer = () =~ /JOHN/g;
Something to think about.