in reply to Finding a Letter at Last line
Though you might want exit codes instead, depending on what's calling thisperl -lne '$s=$_; END{ print "OK" if $s=~/^T/ }' /tmp/foo
Or, using File::Tie:perl -ne '$s=$_; END{ exit($s=~/^T/ ? 0 : 1) }' /tmp/foo
Or, using File::ReadBackwards (untested):perl -MTie::File -e 'tie @f, "Tie::File", shift; exit 1 unless $f[-1] +=~ /^T/' /tmp/foo
perl -MFile::ReadBackwards -e 'exit 1 unless File::ReadBackwards->new( +shift)->readline =~ /^T/' /tmp/foo
|
|---|