in reply to Look Ahead/Behind Via a File Handle

As Zaxo says, using SQL::Statement, or a parsing module of some kind may be easier, but I think your problem could be solved simply using another 'inner' read...something like this (untested!).
while (my $line = <SCHEMA>) { if ($line =~/create table \".+?\"\.(.+?)$/mos) { $table_nm = $1; print BIGLIST "$1 \n"; my $keep = 0; while ($line = <SCHEMA> && $line ne ')') { $table_hash{$table_nm} = 1 if ($line =~ /$var_of_interest/); } } }
Cheers,
Ben.