You might like using File::ReadBackwards, since it efficiently begins reading chunks from the end of the file, without wasting time starting at the beginning and paging your way through the file until you find the end.
my $bw = File::ReadBackwards->new( 'your.filename' ) or die "can't read 'your.filename'\n$!"; if( defined( my $last_line = $bw->readline ) and $last_line =~ m/^T/ ) { # do your processing here... }
If it turns out that it's ok to have leading space before the 'T', you would have to modify the regexp to look like this: m/^\s*T/
Another convenient way (though less efficient) is Tie::File, where your file becomes an array. The last line could be accessed as $file[-1].
Dave
In reply to Re: Finding a Letter at Last line
by davido
in thread Finding a Letter at Last line
by mantra2006
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |