Just another Perl shrine | |
PerlMonks |
Can't access data stored in Hash - help!by corcra (Initiate) |
on Aug 04, 2014 at 23:23 UTC ( [id://1096222]=perlquestion: print w/replies, xml ) | Need Help?? |
corcra has asked for the wisdom of the Perl Monks concerning the following question:
Hello Perl Monks,
I am a novice and would be grateful for your help. I tried to write a piece of code to compare two files which look like File 1File 2 and
I am trying to write a code which prints out file 1 again but if the sample value is not 'REF', looks up file 2. If the corresponding file 2 value is 'REF' then print the original value appearing in file 1. If the corresponding value in file 1 is not 'REF' then print the value we find in file 2. I also wish to ignore positions in file 2 not present in file 1. Using the examples above, my output for the first two rows should look like
The code I have written so far is:
I keep getting the error "Use of uninitialized value within %HashRef in pattern match (m//) at test.pl line 45, <FILE1> line 27". I tried storing the columns I wanted from file 2 in a hash in order to look them up but it just doesn't seem to be working. I have tried everything I can think of but at this stage I am just running into a brick wall. Please help! Any and all suggestions/corrections/criticisms are welcome!
Back to
Seekers of Perl Wisdom
|
|