467,114 Members | 1,255 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,114 developers. It's quick & easy.

Pattern Matchng for only one instance

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
  • viewed: 947
Share:
1 Reply
KevinADC
Expert 2GB
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.

Similar topics

17 posts views Thread by Medi Montaseri | last post: by
3 posts views Thread by Alicia Roberts | last post: by
13 posts views Thread by Robert W. | last post: by
8 posts views Thread by Gaensh | last post: by
2 posts views Thread by FluffyCat | last post: by
34 posts views Thread by Steven Nagy | last post: by
1 post views Thread by halekio@yahoo.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.