open(my $fh, '<', $myfile) or die "Unable to open file\n"; while (<$fh>) { chomp; # <-- here and unless (/^[a-z]/) # <-- here { ...