The most likely place for finding information on this problem is in your course material. Alternatively, asking your peers in your course might also help.
If you have concrete problems, please help us to help you better and show us your code, the error it produces and please also describe what the correct output should be.
This site is not a script writing service. We will try to help you understand your course material but neither will we read it to you nor will we do your homework.
| [reply] |
A hash can be a wonderful friend at a time like this. However hashes bestow their friendship on people who read about them in the fan magazines like perldata and perlfaq and then express the depth of their friendship with sample code.
Will you be a friend of a hash?
Be Appropriate && Follow Your Curiosity
| [reply] |
Well, perl makes it pretty easy to handle a task like this, but it's worthwhile pointing out that standard unix/linux utilities do it easily too...
cut -f1 -d\| input_file | sort | uniq -c
but in order to get the particular output format you want, a little more work is needed, which is actually easiest to do with perl:
... | perl -pale '$_=join "|",$F[1],$F[0]'
The "p","a","l" and "e" command-line options are described in the perlrun manual, and "join" is one of the many built-in functions described in perlfunc (and you can go directly to the description of "join" using the command line perldoc -f join.
Please understand that "looking around the web" might not be a good strategy -- especially if you're "looking for a perl program which could handle..." some task for which you don't know the proper search term (e.g. "histogram" or "token frequency"). Look at resources that teach you how to use perl, look at existing code, play with it, break it, and learn to fix it. | [reply] [d/l] [select] |