in reply to Re^3: How to check if a file has more than one line?
in thread How to check if a file has more than one line?
You can be a little more succinct:
#!C:\Perl\bin use diagnostics; use strict; my $twoLines = 2 == grep {defined <DATA>} 1 .. 2; print "Two or more lines\n" if $twoLines; __DATA__ 1 2
|
|---|