in reply to Re^2: Comparing files
in thread Comparing files

Good grief. Ok, well, if each file could contain the same mac address more than once, use a second hash to guarantee uniqueness per file. Or another approach would be to start with file one. Put all of its mac addresses into a hash, as keys. Then open file two. Delete any hash keys that aren't found in file two. Open file three. Delete any remaining hash keys that aren't found in file three. And so on... you get the idea. What's left at the end is your list of mac addresses that exist in all 30 files.


Dave

Replies are listed 'Best First'.
Re^4: Comparing files
by dannyp (Novice) on Jul 20, 2004 at 03:27 UTC
    davido, I like your idea on how to do this. My questions are. How do you read a file into just the hash keys? How would I code, deleting hash keys from file1 that are not found in file2. Thanks

      Since I don't want to do your script writing for you from start to finish, I'll just ask, what are you specifically stuck on?

      Is it...

      If you're close on something that you just need a little help with we're all here for you. But as mentioned before, don't try to struggle with all this if you're not "there yet". If you're not even close, take a step back, and tackle the more rewarding project of reading "Learning Perl." It's a great book, published by O'Reilly & Associates. You'll recognize it by the Llama on its cover and the light blue book spine. Pretty much everything you're asking is covered in that book. But without a basic understanding of Perl, as taught by a book like that, or by studying the online Tutorials and the Perl POD, you're going to have a difficult time writing the script.


      Dave

        I have read learning perl 2 times. I also have programming perl by larry wall as well. Where I think I am confused is, I thought a hash had to have a key and a value. How do I get my mac addresses to just be keys and if they are the keys what are the values then, i'm assuming undef. What I need to know is, how to write a file into the keys of a hash. I know how to open the file using the filehandle, from there is what I cant figure out.