Right here's the problem:
i have one file (input), which contains keywords to be matched
and solution.java is the file i want to check through for the keywords.
so far i have written a program that will look at the first line (ie keyword) in input and loop through solution.java to see if it exists. the second line in input (ie 2nd keyword) is then used to search through everyline of solution.java to see if it exists. this continues for all lines in input.
so my program will print out "yes the", $keyword, " exists";
for every line it is found in solution.java.
this is great but a counter would be far more useful.
if i know how many lines there are in input it is easy to create $counter 1, $counter2 etc for each line. the problem comes as the number of lines of input can vary. So i need a way to create a separate counter for each line in input.
i hope i havent lost anybody and any help would be gratefully received
below is my current loop, HTH
#####################
# lines is solution.java
# lines2 is input
for ($a=0; $a<$#lines+1; $a++){
for ($b=0; $b<$#lines2+1; $b++){
if ($lines[$a] =~ /$lines2[$b]/) {
print $lines[$a];
print "\nyes ", $lines2[$b], " exists\n\n";
}
}
}
#####################
cheers Stort
i have one file (input), which contains keywords to be matched
and solution.java is the file i want to check through for the keywords.
so far i have written a program that will look at the first line (ie keyword) in input and loop through solution.java to see if it exists. the second line in input (ie 2nd keyword) is then used to search through everyline of solution.java to see if it exists. this continues for all lines in input.
so my program will print out "yes the", $keyword, " exists";
for every line it is found in solution.java.
this is great but a counter would be far more useful.
if i know how many lines there are in input it is easy to create $counter 1, $counter2 etc for each line. the problem comes as the number of lines of input can vary. So i need a way to create a separate counter for each line in input.
i hope i havent lost anybody and any help would be gratefully received
below is my current loop, HTH
#####################
# lines is solution.java
# lines2 is input
for ($a=0; $a<$#lines+1; $a++){
for ($b=0; $b<$#lines2+1; $b++){
if ($lines[$a] =~ /$lines2[$b]/) {
print $lines[$a];
print "\nyes ", $lines2[$b], " exists\n\n";
}
}
}
#####################
cheers Stort