Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
I/O problems...what am I missing?by psychoto (Novice) |
on Sep 16, 2002 at 05:34 UTC ( [id://198158]=perlquestion: print w/replies, xml ) | Need Help?? |
psychoto has asked for the wisdom of the Perl Monks concerning the following question:
I've written a very basic program that reads one long line of data from an external file and the data is supposed to be sorted and then displayed. Very basic stuff here. I wrote the code without using any sort opperator, because I wanted a change. My output isn't quite what I'm expecting and for the life of me I cannot locate the problem....Any ideas? The basic code for the program is as follows:: My input file is as follows: Perl Programming:Joe Smith, 87:Jane Thompson, 93:Ed Jones, 75:Nancy Edwards, 84:James Allen, 64:Peggy Johnson, 68:Bill Swanson, 98:Thomas Jefferson, 76:Abraham Lincoln, 71:John Adams, 84:Theodore Roosevelt, 66:John F. Kennedy, 80:Jimmy Carter, 75:Ronald Reagan, 97:Grover Cleveland, 95:Dwight D. Eisenhower, 96:George Bush, 94: The desired output I am hoping for is: Line 1 -- A header displayed with class title and # of students. Line 2 -- Lowest score on test Line 3 -- Highest score Line 4 -- Average Line 5 -- blank Line 6+ (Name of student) scored (score) sorted from low score to high score.Currently my output is very scattered. Only 3 students are displayed, and no scores are displayed other than High/low/average. I believe my pseudo-sort is funtioning...but I'm unsure. I've stared aimlessly at this code for 2 hours now and thought maybe I should post if for all the "gurus" to glance at it and fix my problem in 12 seconds. Thanks in advance Great and Mighty Monks!!!
Back to
Seekers of Perl Wisdom
|
|