(another in an occasional series)
grep -m <matches>
One of the many handy options to
grep (there'll be quite a few in this series), the
-m option controls how many matches are displayed for each file grep scans.
For (hypothetical) example:
grep -m 1 '^sub' *.pm # find the first sub definition in each file