set faq directory set list of filenames get search pattern LOOP: for each file in list of filenames LOOP: until end of file read a line from the file IF line starts with =head2 and line has pattern THEN print filename and line END IF END LOOP END LOOP