in reply to help with an array

I might be misunderstanding the question, but if not, I think the solution is as easy as this:
use strict; my $countline = 0; my $mytest; my @array = (); #<- added line open (MYFILE,"<testing.txt")||die "Could not open input file\n"; while($mytest = <MYFILE>) { my @datas= split (/\s+/, $mytest); if ($datas[0] eq "Hello") { $countline++; $array[$countline] = $countline; #<- added line } my @test1 = $countline; print $test1[0]; }