I recommend doing this as a program separate from your project first. You can debug it without any consideration of the internet processing. Then, you can drop the finished code into your internet program as a subroutine.
First learn about while, Arrays, Matching Regex and splitting text into column values and do small sub-exercises. Then do a large exercise that combines these while reading files.
While: Step B discussed a while loop that will read a file and provided an exercise. To learn more about while loops in perl, you can read: https://docs.google.com/viewer?url=http%3A%2F%2Fblob.perl.org%2Fbooks%2Fbeginning-perl%2F3145_Chap04.pdf
Matching Regex: To match a text line to a regular expression, use =~ and put your pattern between slashes /patttern/. To learn more about this, read: https://docs.google.com/viewer?url=http%3A%2F%2Fblob.perl.org%2Fbooks%2Fbeginning-perl%2F3145_Chap05.pdf Or a very simple tutorial http://www.comp.leeds.ac.uk/Perl/matching.html
Sub-Exercise: Ask the user for a word and then say good if it contains the word good and bad if it does not. Run this in perl to test.
Use Arrays: To use an array, here are some facts:
Sub-Exercise: Ask the user for a word and place it into an array. Keep asking the user for more words and continue adding them into an array until the user enters STOP. Then print all the values. Use push to add values onto the array and for each to display values from the array (and print) so you do not have to use for counting loops.
Splitting: A little more on splitting because you may want to use split to parse your file line into fields: http://www.comp.leeds.ac.uk/Perl/split.html
You can put multiple variables on the left side of a split, and it will fill the variables in order, so if you have in $line:
1|mario|game
use this to split it into 3 variables in the order they are split by the matching pattern:
($key, $name, $type) = split(/|/,$line) ;
Sub-Exercise: Ask the user for their first and last name, separated by a comma. Use the split command to fill the variable $first and $last and then print hello to just the first name.
Your job: First try the sub-exercises to be sure you understand these commands. You do not have to turn in the sub-exercises, but they will help doing this larger exercise: Look at your project files. Find one word that appears in more than one row, and save that to use as your search word. Read one of your project files and copy all the keys that have a match to that word. Then print the keys. Discover whether they keys have spaces before or after them by printing characters surrounding the keys.
For example, if you had
1|mario|game
2|pokemon|game
3|mario brothers|gameYou could use mario as a hard coded search word and the result of the program would be :
my keys are X1X, X3X.