open AD, "file1.txt";
close AD; #hash out of the contents of the first file=MADE
open FH, "file2.txt";
if (...what do i do here???..)
the thing is i want the results with respect to the entries in file1.txt and not the other way around. so if i make the second file as hash, then wont that make the prblem exactly opposite? as for the iteration, i am sorry i think i missed a bracket } there.. sorry for the mistake.
Please tell me wat to do.
When you say you need to "check whether a value exists in something," that almost always means you should put something in a hash, and then check your values against that hash. Since you want to check whether values from file1 exist in file2, you put file2 in a hash (with the part you're checking against as the keys), and then start looping through file1 and checking its values to see if they exist as keys in the hash.
For starters, you don't check if open() actually worked. That's not good. You should also use strict; and use warnings; too.
You should also use a consistent coding and indenting style. Doing so will help you see the logic flow of your own code. perltidy can help you with that.
This may sound like i'm picking out the "unimportant" parts of software design. Well, actually, no i'm not. First you have to get the basics right. Then, the tools you use can actually help you in developing your script by telling you about certain problems you might have overlooked.
Don't use '#ff0000':
use Acme::AutoColor; my $redcolor = RED(); All colors subject to change without notice.