in reply to Printing the count for regex matches

my @match; while (<DATA>) { my $string_found = $_; push @match,( $string_found =~ /(first_string|second_string|third_st +ring|fourth_string|fifth_string)/gm ); } print scalar @match," matches found: ",join ", ",@match, "\n";

Note that the var $string_found and the braces around the regex are superfluous