#! /usr/bin/perl use strict; use warnings; my $n = "ABCDABDIDAOFOOFAA" ; my $d = ($n =~ /A/g) ; print "matches $d" ; #### matches 1