By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,541 Members | 1,455 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,541 IT Pros & Developers. It's quick & easy.

Pattern Matchng for only one instance

P: 36
Hi all,
i have a text file in which i am searching for a pattern which appears many times, but i just want to search for the 1 instance only and it should skip all other similar pattern.

your help will be appreciated and thanking you in advance

jain
Jun 26 '08 #1
Share this Question
Share on Google+
1 Reply


KevinADC
Expert 2.5K+
P: 4,059
Expand|Select|Wrap|Line Numbers
  1. while (<>) {
  2.    if (/(pattern)/) {
  3.       print "found 'pattern' in line number $.\n";
  4.       last;
  5.    }
  6. }  
Jun 26 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.