To answer your questions in reverse order....

Second, why is this a considered a subroutine ref in the first place? I thought that a subroutine ref was this: \&Subref, which would return a memory address.

That's a "hard" reference. A "soft" reference is something of the form

$foo = 'bar'; $$foo = 'baz'; print $bar; #prints 'baz'

To answer your first question, AFAIK, you can't. The whole point of use strict 'refs' is to prevent you from using soft references. Furthermore, you can't use hard references as hash keys (they get converted to strings, and reference count information is lost). Perhaps this would work instead?

#!/usr/bin/perl -w use strict; my %Foo = ('Routine' => { SUB => \&Routine, FLAG => 1 }, 'Option' => { SUB => \&Option, FLAG => 0 } ); foreach (keys %Foo) { $Foo{$_}{SUB}->() if $Foo{$_}{FLAG}; }

--
Ryan Koppenhaver, Aspiring Perl Hacker
"I ask for so little. Just fear me, love me, do as I say and I will be your slave."


In reply to Re: by rlk
in thread "No strict refs" will be the death of me by BlueLines

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.