Pattern matching in perl

  • Thread starter praveen.kantharajapura
  • Start date
P

praveen.kantharajapura

Hi all,

I have a file now i need to search for two strings "string1" and
"string2" in the same line.If both of them occur in the same line
increment a counter else do not.

How to go about doing this in perl??

Regards,
Praveen
 
J

Josef Moellers

Hi all,

I have a file now i need to search for two strings "string1" and
"string2" in the same line.If both of them occur in the same line
increment a counter else do not.

How to go about doing this in perl??

Try it?
 
J

Jürgen Exner

I have a file now i need to search for two strings "string1" and
"string2" in the same line.If both of them occur in the same line
increment a counter else do not.

How to go about doing this in perl??

Which part is the problem?
- the check if a string is contained in another string? See 'perldoc -f
index'
- to combine two conditions? See 'perldoc perlop', operator 'and'
- to create a if clause? See 'perldoc perlsyn', and then the if
statement in section compound statements
- to increment a counter? See 'perldoc perlop', operator +=
- to do nothing? Well, ....

jue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top