CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions:
Perl regex

 



krishNiran
New User

Dec 19, 2009, 9:28 PM

Post #1 of 4 (3467 views)
Perl regex Can't Post

How to compare the Strings in two different text files using perl regex ?

hai.txt
-------
designation: Manager
name: David
age: 40

bye.txt
--------
designation: Manager
name: Alex
age: 41

I want two compare hai.txt and bye.txt files name and age (If designation is manager only then i need to compare name and age ) ? If designation is different then i need to create another text file and write designation, if name/age is different then i need to create another text file and write designation and name/age.


7stud
Enthusiast

Dec 19, 2009, 11:00 PM

Post #2 of 4 (3463 views)
Re: [krishNiran] Perl regex [In reply to] Can't Post

split()

if-elsif


krishNiran
New User

Dec 20, 2009, 7:52 AM

Post #3 of 4 (3447 views)
Re: [7stud] Perl regex [In reply to] Can't Post

I don't think so split() will help. Please give sample code.


FishMonger
Veteran / Moderator

Dec 20, 2009, 8:24 AM

Post #4 of 4 (3441 views)
Re: [krishNiran] Perl regex [In reply to] Can't Post

The split function could be used to split each line into key/value pairs and compared with the other file.

This looks like your homework assignment.

Please post your code and a specific question on the part that is giving you trouble. Include any/all warnings/errors that your code produces.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives