in reply to Help with getting everything from X until Y

Since you are using the <br> tag as the delimiter up to which you are getting stuff (and the next found instance of an html line break tag), you could use it to break up your data through use of $/. By that i mean something like the following:
use strict; use warnings; local $/ = "<br>"; while ( <DATA> ) { print $1 if /Title:(.*?)<br>/s; } __DATA__ a whole lot of worthless stuff <b>Title: </b> STRING_I_WANT<br> more worthless meaningless stuff or sometimes <b>Title: </b>ANOTHER STRING_I_WANT<br>

update: This should take care of the extra stuff. I reread your requirement, everything from "Title:" to <br> and did what that specified instead of just the strings you wanted. The following only retrieves those strings and shows you how to put it in a variable (basically assign $1 to something) (see rob au's response which answers the question you asked). Good luck, here is the code:

use strict; use warnings; local $/ = "<br>"; while ( my $line =~ <DATA> ) { if ( $line =~ /Title:.*?<\/b>\n?(.*?)<br>/s ){ my $saved_var = $1; print "$saved_var\n" } } __DATA__ a whole lot of worthless stuff <b>Title: </b> STRING_I_WANT<br> more worthless meaningless stuff or sometimes <b>Title: </b>ANOTHER STRING_I_WANT<br>

-enlil