I do not have to do the explicit setting of $RtnVal (since it is set in the subs)...     [emphasis added]

This implies that  $RtnVal is a global. Along with hdb, I'm handicapped by not having an example of the referenced code, e.g., emailagenda(), but are you aware that a subroutine, named or otherwise, that does not have an explicit return statement implicitly returns the value of the last expression evaluated within the subroutine? A situation something like the one described in the OP can be imagined via this scenario:

>perl -wMstrict -le "our $RtnVal; our $SomeOtherGlobal; ;; my $coderef = sub { $RtnVal = $_[0]; if ($RtnVal eq 'Ok') { $SomeOtherGlobal = 'Foo'; } }; ;; for my $arg (qw(Ok NotOk)) { $RtnVal = $coderef->($arg); print qq{RtnVal '$RtnVal'}; } ;; for my $arg (qw(Ok NotOk)) { $coderef->($arg); print qq{RtnVal '$RtnVal'}; } " RtnVal 'Foo' RtnVal '' RtnVal 'Ok' RtnVal 'NotOk'

In reply to Re^3: Return value from code reference stored in dispatch table by AnomalousMonk
in thread Return value from code reference stored in dispatch table by SteveTheTechie

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.