http://qs321.pair.com?node_id=655252

paulnovl has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I'm grepping with Perl, but want to stop after the first match.

My input file contains several identical 2-line strings like this (scattered amongst other data):

# /proc/cpuinfo vendor_id : IBM/S390

This is what I have so far:
m#cpuinfo\nvendor_id\s+:\s(.*?)\n# and print "CPU:\t$1";

That returns:
CPU: IBM/S390 CPU: IBM/S390 CPU: IBM/S390

How can I tell it to stop searching after the first match?

Thanks.