in reply to Take last instance of a string

You had good replies, but if i can add something, i would start with a simpler approach: a linear one, accomulating results and eventually discard them if unneeded. Consider:

use strict; use warnings; my $trig = 'Significant Accounting Policies'; my $res; while (<DATA>){ if ($_ =~/$trig/i){ $res = $_; next; } $res.=$_ if $res; } print $res; __DATA__ Wal-mart talks about its Significant Accounting Policies in its 10k. Significant Accounting Policies are important for a firm. Here is a list of the Significant Accounting Policies 1)Lifo 2)Depreciation 3)Expenses

Or a similar approach but using a pointer:

my $trig = 'Significant Accounting Policies'; my @res; my $pointer; while (<DATA>){ $res[$.-1] = $_; # or just: push @res,$_; $pointer = $.-1 if /$trig/i; } print @res[ $pointer .. $#res ];

HtH
L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.