time perl -e '$_=[];@$_=<>; my $count=@$_;print $count, " lines\n";' < somefile.txt time perl -e '{$/=undef, $_=<>} my $count=split /\n/,$_; print $count, " lines\n";' < somefile.txt