So now I have got keys and values.

You may think you do, but you don't. Post runnable code ala How do I post a question effectively?, like

#!/usr/bin/perl -- #~ 2011-07-05-05:39:58 Anonymous Monk #~ http://perlmonks.com/?node_id=912812# Read file in a hash and compa +re the 'values' from file 2 #~ perltidy -csc -otr -opr -ce -nibc -i=4 use strict; use warnings; use autodie; use Data::Dumper qw/ Dumper /; use 5.010; Main(@ARGV); exit(0); sub Main { if ( @_ == 2 ) { NotDemoMeaningfulName(@_); } else { Boobbly(); print Usage(); } } ## end sub Main sub NotDemoMeaningfulName { my ( $inputFile, $outputFile ) = @_; open my ($inFh), '<', $inputFile; open my ($outFh), '>', $outputFile; my $d; my $read; my %hash; while (<$inFh>) { $d = $_; $read .= $d; my ( $key, $val ) = split /\n/, $read; $hash{$key} = $val; } ## end while (<$inFh>) print $outFh Dumper( \%hash ); } ## end sub NotDemoMeaningfulName sub Usage { <<"__USAGE__"; $0 inputfile outputfile __USAGE__ } ## end sub Usage sub Boobbly { #~ http://perlmonks.com/?abspart=1;displaytype=displaycode;node_id=912 +812;part=1 my $Furrry = <<'__Furrry__'; >1 ##key abcdef ##value >2 hijkl >3 abnikhl..etc __Furrry__ NotDemoMeaningfulName( \$Furrry, \my $Farts ); print $Farts, "\n\n"; } ## end sub Boobbly __END__ $VAR1 = { '>1 ##key' => 'abcdef ##value' };

Also read these FAQ items
How can I tell whether a certain element is contained in a list or array?
How do I compute the difference of two arrays? How do I compute the intersection of two arrays?
How do I test whether two arrays or hashes are equal?

In reply to Re: Read file in a hash and compare the 'values' from file 2 by Anonymous Monk
in thread Read file in a hash and compare the 'values' from file 2 by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.