in reply to regex with comparing

I would think about reading the change file and creating a hash whose keys are all the lines that have changed, something like this:
if ($info =~ /(\d+)-(\d+)/) { $changes{$file}{$_} = 1 foreach ($1..$2) } else { $changes{$file}{$info} = 1; }

Then, in a separate loop, I'd iterate through the lines in the data file and test each one, something like this:

$line =~ m/~(\d+)~/; print $line if $changes{$file}{$1};