in reply to How to check if a file has more than one line?

Perhaps this:
perl -e 'my $c = <> for 1..2; print "One line\n" if $. == 1;' file.txt