I have a HASH where each key contains an Object, but when I run loop to update the contents of the object it tries to call the method from the different object to the one I'm updating (hope my object oriented teminology is correct). For example:

the Hash is structured:
'file'<br> DT_File=HASH(0x3211db4)<br> 'Dedupe_level' => undef<br> 'Delimiter' => ','<br> 'Display_Record' => ARRAY(0x185becc)<br> empty array<br> 'Header' => 1<br> 'Header_Record' => ARRAY(0x185bc80)<br> empty array<br> 'Name' => 'current'<br> 'Record' => 1<br> <br> 'Salutation'<br> Salutation=HASH(0x3212924)<br> 'Dear' => 1<br> 'Fullname1' => ''<br> 'Fullname2' => ''<br> 'Initial1' => ''<br> 'Initial2' => ''<br> 'Sal_file' => 'current'<br> 'Surname1' => ''<br> 'Surname2' => ''<br> 'Title1' => ''<br> 'Title2' => ''<br>
where 'file' and 'Salutation' are the HASH keys and 'DT_File' and 'Salutation' are the objects

The code below cycles through the methods for each object and updates it with a new value from a master object. The problem I have is that the first loop which updates elements for the 'DT_File' object, errors saying that it cannot find the method in the 'Salutation' object?
#@file_parameters contains object method names foreach my $param (@file_parameters){<br> $current{'file'} -> $param($source_file{$key}->$param);<br> }
can anyone tell me why the code thinks I am looking for the method in the 'Salutation' object rather than the 'DT_File' object?

Thanks

In reply to Object selection query by Kraythorne

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.