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):
This is what I have so far:# /proc/cpuinfo vendor_id : IBM/S390
That returns:m#cpuinfo\nvendor_id\s+:\s(.*?)\n# and print "CPU:\t$1";
How can I tell it to stop searching after the first match? Thanks.CPU: IBM/S390 CPU: IBM/S390 CPU: IBM/S390
Back to
Seekers of Perl Wisdom