in reply to Matching Regular expression at EOF
Use File::ReadBackwards to read the lines of the file and then stop at the first match.
use File::ReadBackwards; tie *BW, 'File::ReadBackwards', 'file' or die "can't read 'file' $!"; while ( <BW> ) { if ( /pattern/ ) { print; last; } }
|
|---|