That depends on what you want to do. If you want to use names of subroutines in a list, and use the names to call the subs, you will be using symbolic references - which will not be permitted with 'use strict "refs"'. So, you're only option is to turn of 'use strict "refs"' when performing this call. And there's nothing wrong with that. 'use strict "refs"' prevents you from accidently using symbolic references - but here, you are doing it on purpose.

Another way of handling this situation is to use the line

my @testlist = (\&test1, \&test2);
This gives you actual code references. However, I realize your program is just a mockup - and in your real program the list of names might come from somewhere else, and can't be replaced with a list of code references.

In reply to Re: strict refs usage by Anonymous Monk
in thread strict refs usage by gwowi

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.