fseng has asked for the wisdom of the Perl Monks concerning the following question:
Hi everyone, I'm just starting learning Perl. Work give me this exercise to do which I found a bit hard.I need to come back with answers tomorrow afternoon. So answers to any question will be great help please!!!
QUESTION1: Write a program to read in the following comma delimited data file into a data structure of A REFERENCE ARRAY OF HASHES, and performs each of the steps:
b) Print out a sorted list of Surnames only.
c) Print all lines except those with member numbers 34 and 11.
d) Write a new file with the records in reverse order (i.e. print the last record first).
e) Write a new file with only rows where the score is greater than 100.
f) Read in file you made in question a) and write it out as tab delimited records.
QUESTION 2 There are two data files with contents as follows:
b) Comment on how well your solution scales for files with hundreds of thousands of records (Hints: the extracts list should be much shorter than the whole clients list. How would you approach this question if both data files are huge?)
QUESTION1: Write a program to read in the following comma delimited data file into a data structure of A REFERENCE ARRAY OF HASHES, and performs each of the steps:
a) Read in the records and write them out as 15 characters each with the first name in capitals.Member Number, First Name, Last Name, Subject, Score ----------------------------------------------------- 01,Newton,Issac,Physics,144.56 34,Einstein,Albert,Physics,12.22 78,Feynman,Richard,Physics,-17.34 11,Beethoven,Wolfgang,Music,11.78 89,Merx,Eddie,Cycling,319.01
b) Print out a sorted list of Surnames only.
c) Print all lines except those with member numbers 34 and 11.
d) Write a new file with the records in reverse order (i.e. print the last record first).
e) Write a new file with only rows where the score is greater than 100.
f) Read in file you made in question a) and write it out as tab delimited records.
QUESTION 2 There are two data files with contents as follows:
a) Write code to print only those client details that have their key in extracts.txt. Note that there are (at least) two main ways to do this.client.txt extracts.txt (Member ID, Member Name) (Member ID) ------------------------------- ----------------- 017,Billy Bloggs 024 024,Joe Cocker 099 099,Mozart 182 116,Oliver Bierhoff 182,Francois Mitterand 209,Lois Lane
b) Comment on how well your solution scales for files with hundreds of thousands of records (Hints: the extracts list should be much shorter than the whole clients list. How would you approach this question if both data files are huge?)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: a REFERENCE of array of hashes
by why_bird (Pilgrim) on Jun 24, 2009 at 08:48 UTC | |
by Anonymous Monk on Jun 24, 2009 at 11:05 UTC | |
by why_bird (Pilgrim) on Jun 24, 2009 at 13:41 UTC | |
by why_bird (Pilgrim) on Jun 24, 2009 at 13:38 UTC | |
by Anonymous Monk on Jun 24, 2009 at 13:57 UTC | |
by Anonymous Monk on Jun 24, 2009 at 11:37 UTC | |
by why_bird (Pilgrim) on Jun 24, 2009 at 13:25 UTC | |
Re: a REFERENCE of array of hashes
by Corion (Patriarch) on Jun 24, 2009 at 07:44 UTC | |
by fseng (Novice) on Jun 26, 2009 at 00:21 UTC |
Back to
Seekers of Perl Wisdom