raghuraipur has asked for the wisdom of the Perl Monks concerning the following question:
hi everyone,
before stating my problem ,
i just want to say
thanks in advance for the time and trouble taken:-)
i am an newbie to perl programming,
the problem is a text file needed to be parsed,
i have looked over regular expressions and string matching but coudnt helped out..myself
the text file contained the format:-
A,1,B
A,2,B
A,1,C
C,1_1,A
B,2,D
B,1_1,A
B,2_2,A
B,2_2,D
after doing the required parsing of a text, the output must be in the following format shown below
A,1,B
B,1_1,A
A,2,B
B,2_2,A
A,1,C
C,1_1,A
B,2,D
D,2_2,D
can anyone let me know how to get the above required format?
thanks
raghuraipur
Re: problem with parsing
by jethro (Monsignor) on Jul 06, 2011 at 14:12 UTC
|
You need to parse the string first. Use split with ' ' and store the data in an array and sort it. Don't forget to chomp strings if you read the data from a file. Try to solve the problem step by step, use lots of prints to check what your script is doing and you will see that it is easier than you thought
Now if you have any more questions, just post what you have done already and we can help you. But please remember, we are not here to do the homework for you, we only try to help *you* write the code.
| [reply] |