#!/usr/bin/perl use strict; my $fileForLineCount = $ARGV[0]; my $lineCount = 0; my $buffer = 0; open (my $targetHandle, "<", $fileForLineCount); while(sysread $targetHandle, $buffer, 4096) { $lineCount += ($buffer =~ tr/\n//); } close $targetHandle; print STDERR "$lineCount\n\n";