1.when we open a file,how we can fetch the whole content to make comparison?

open N, "<main.pl";
#whole content of main.pl
if(??=~m/$thr=asyn/)
{
...
}
close N;

2.if our match pattern contain variable and parameter,how can we define?

the pattern in main.pl is $dbh_xxx

in my program match.pl;

$id=param("id");
open N, "<main.pl";
#whole content of main.pl
if(??=~m/$dbh$id/)
{
...
}
close N;

how to write the pattern since $id is dynamic in match.pl and $dbh is variable in main.pl?