$/ = "\n"; my $count; open (FH, "myfile.text") || die "Cannot open file: $!"; $count++ foreach (); close FH;