in reply to help with an array

Looks like a job for grep.
use strict; open (MYFILE,"<testing.txt")||die "Could not open input file\n"; my @datas = grep /^Hello\s+/, <MYFILE>; my $countline = $#datas + 1; # or just treat $#datas as linecount-1

One world, one people