Re: frequency strings 2 filesby xyzzy (Pilgrim)
|on Jul 06, 2012 at 04:21 UTC||Need Help??|
Zerost: until you are comfortable enough to code blindfolded, every program you write should start with the following two lines:
First: go over the problem, separate it into individual components. what do you need to do? what values do you need to keep track of? what are the steps that need to be taken? this is basic programming 101 stuff. before you write a single line of code, you need to be able to explain the exact procedure step by step (in pseudocode, English, pictures, whatever).
Second: look at the specific features of the problem and the language and how they work together. The files are given in a certain order, maybe that is telling you something. Perl has a handy mechanism to read input line by line, maybe you should use that.
Third: you have an incredibly useful resource at your disposal if you run into problems. It is called perldoc, and you can run if from the shell (it even works with windoze implementations of perl) or browse it online. It has sections for every topic and very detailed explanations for every built-in function, every operator, every special variable. READ IT!
Finally: do not ask the monks to do your assignment. Even if they give you a solution, it will most likely be obfuscated or use an overly-elegant, roundabout way to do it, and if your prof looks at it he will instantly know that you have no idea how or why it works. However, if you read the docs, used strict and warnings, tried an approach that seems to be valid and your code still does things you do not expect or understand, post it as a specific question, such as "Errors reading from filehandle" or "Hash keys aren't matching", provide your code, your expected output, your actual output, and your reasoning as best as you can understand the issue. Then you actually will get an answer explaining how that specific function or operator works, and you will learn how to use the language.
At the risk of being ostracized from the community, I will give you two huge hints.
$,=qq.\n.;print q.\/\/____\/.,q./\ \ / / \\.,q. /_/__.,q..
Happy, sober, smart: pick two.