Hello,

I would like some help with the following issue. I have code with creates a new object (object->new) and wish to use it a sub. This works fine with the passing of the object as reference. However, when I want to pass the object to another function, I fail to get the reference across correctly. What am I doing wrong?

main... $object->new; func1($object); func2($object); sub func1 (\$) { my $object=shift; $object->doSomething; } sub func2 (\$) { my $object=shift; $object->doSomethingElse; func1 ($object); }

Probably the call fo func1 in func2 has the variable added incorrectly, but I'm unable to find the solution for this. I can't believe this isn't possible in perl, so I must be at fault.

BTW awaiting the email for activating my account T_I I'm posting this anonymously.


In reply to Use reference for functions in functions 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.