I'm having trouble changing the reference of a subroutine.   Here is how I start.
$localfile = 'customer'; $ulocalfile = ucfirst($localfile); $newdir = "$path/$localfile"; MakeDir(); # # SECOND GET THE FILE LAYOUT AND INITIALIZE FILE MANAGEMENT TOOLS # $getfile = "Read$ulocalfile"; $updatefile = $guestfile = "Write$ulocalfile"; $deletefile = "Delete$ulocalfile"; require "$path/files/$ulocalfile"; require "$path/processes/GuestBook";
In just a little bit I set $updatefile = 'ProcessGuestBook';

The main script calls the subroutine by &$updatefile. So far so good. Now when I get into the ProcessGuestBook subroutine I have a need to change &$updatefile to refer to it's orginal value. I thought I could just reset it by $updatefile = $guestfile and then invoke the subroutine &$updatefile. What I get is an error letting me know that the script can't find the subroutine.

Any way to change the reference on the fly?
UR

janitored by ybiC: Retitle from "anonymous subroutine", minor format tweaks for legibility


In reply to Symbolic reference to a subroutine by UncleRon

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.