in reply to Reading entire file.

Well if you want to check if you are between two point in a file then use the ... operator. eg
if(/$foo/.../$bar/){ }
evaluates to true if the current line is between the two regular expressions.