http://www.perlmonks.org?node_id=715132


in reply to Reading "slices" out of a file at known start markers

The RANGE-operator will do the trick here:
use strict; while (<DATA>) { print if m/^SOURCES/ .. m/^RECURSIVE_TARGETS/ and not m/^RECURSIVE +_TARGETS/; } __DATA__ YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) LTYACCCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) + \ --mode=compile $(YACC) $(YFLAGS) $(AM_YFLAGS) YLWRAP = $(top_srcdir)/ylwrap SOURCES = $(libpiuserland_la_SOURCES) $(pilot_addresses_SOURCES) + \ $(pilot_clip_SOURCES) $(pilot_csd_SOURCES) + \ $(pilot_debugsh_SOURCES) $(pilot_dedupe_SOURCES) + \ $(pilot_dlpsh_SOURCES) $(pilot_file_SOURCES) + \ $(pilot_foto_SOURCES) $(pilot_foto_treo600_SOURCES) + \ $(pilot_foto_treo650_SOURCES) $(pilot_getram_SOURCES) + \ $(pilot_getrom_SOURCES) $(pilot_getromtoken_SOURCES) + \ $(pilot_hinotes_SOURCES) $(pilot_install_datebook_SOURCES) + \ $(pilot_install_expenses_SOURCES) + \ $(pilot_install_hinote_SOURCES) $(pilot_install_memo_SOURCES) + \ $(pilot_install_netsync_SOURCES) $(pilot_install_todo_SOURCES) + \ $(pilot_install_todos_SOURCES) $(pilot_install_user_SOURCES) + \ $(pilot_memos_SOURCES) $(pilot_nredir_SOURCES) + \ $(pilot_read_expenses_SOURCES) $(pilot_read_ical_SOURCES) + \ $(pilot_read_notepad_SOURCES) $(pilot_read_palmpix_SOURCES) + \ $(pilot_read_screenshot_SOURCES) $(pilot_read_todos_SOURCES) + \ $(pilot_read_veo_SOURCES) $(pilot_reminders_SOURCES) + \ $(pilot_schlep_SOURCES) $(pilot_wav_SOURCES) + \ $(pilot_xfer_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive + \ html-recursive info-recursive install-data-recursive + \ install-dvi-recursive install-exec-recursive + \ install-html-recursive install-info-recursive + \ install-pdf-recursive install-ps-recursive install-recursive + \ installcheck-recursive installdirs-recursive pdf-recursive + \ ps-recursive uninstall-recursive

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James