in reply to comparing elements in 2 hashes...

assuming the lines are the keys...
for(keys %Hash1) { print "$_\n" if exists $Hash2{$_}; }
That'll do it... if you want case insensitive matching you can lowercase both files first...

though you might be better off to read in the key file, and then go line by line through the main file looking up the lines in the key hash... save lots of memory, probably...

then again... hashes may not be the way to go at all... what does your data look like?

Update hrm... does look a bit like homework... but isn't it summer?

                - Ant
                - Some of my best work - (1 2 3)

Replies are listed 'Best First'.
Re: Re: comparing elements in 2 hashes...
by RMGir (Prior) on Jul 02, 2002 at 19:09 UTC
    but isn't it summer?

    Australia? Or any of the other countries "down south"...
    --
    Mike

      You mean... they have SCHOOLS in AUSTRALIA?!?! But that blows my whole theory on the Crocodile Hunter! ;) (is he even really australian?)

                      - Ant
                      - Some of my best work - (1 2 3)

        Becoming a bit of an old fart, may I point you towards the original? This new guy doesn't even come close... :)

        cLive ;-)

        --
        seek(JOB,$$LA,0);