#!/usr/bin/perl -w use strict ; if (open (my $file, '/testfile')) { while (<$file>) { print if 1../^## START/ ; } close $file ; }