It sounds like you want to stop reading the file once you have found what you are looking for. If you read the file in a while loop you can break out of the loop with last. Like this
while (my $line = <$inputFH> )
{
next unless $line =~ m{some pattern};
# Process wanted line here ...
last; # Break out of while loop
}