use strict; #### use warnings; # as well! #### my $countline = 0; my $mytest; open (MYFILE,"## open my $fh, '<', "testing.txt" or die "Could not open input file: $!\n"; #### while($mytest = ) { #### while( defined($mytest = ) ) { #### while() { #### my @datas= split (/\s+/, $mytest); if ($datas[0] eq "Hello") #### if ( (split /\s+/, $mytest)[0] eq "Hello" ) #### if ( (split)[0] eq "Hello" ) #### $countline++ if +(split)[0] eq "Hello"; #### my @test1 = $countline; print $test1[0]; #### while (<>) { push @wanted, $_ if +(split)[0] eq "Hello" }