#!/usr/bin/perl use strict; use warnings; #use diagnostics; # optional use Getopt::Std; ... #### $ perl -Mstrict -Mwarnings -E ' my @in_strings; while (<>) { push @in_strings, $_; } my $count = grep /authenticated/ => @in_strings; say "count = $count"; ' qwerty asdfgh zxcvbn authenticated unauthenticated not authenticated count = 3