variation on (?) call subroutine by reference

Discussion in 'Perl' started by Alison Bowes, Feb 18, 2005.

  1. Alison Bowes

    Alison Bowes Guest

    I know that if $subname contains the name of the subroutine I want to call,
    I can call that subroutine via
    &$subname;

    However, my subroutine names are in an array, so if I want to call
    $subname[3] I've tried
    &$subname[3];

    But, that doesn't work, and I'm not having much luck finding such an
    example. If I'm doing something truly numbskulled, I do apologize!

    I do realize I could go this route:
    $this_sub = $subname[3];
    &$this_sub;

    That just seems so clunky and unnecessary, no?

    TIA,
    Alison
    Alison Bowes, Feb 18, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Erlend Andreas Garberg

    Travelling salesman variation in python

    Erlend Andreas Garberg, Apr 1, 2004, in forum: Python
    Replies:
    20
    Views:
    4,149
    G√ľnter Jantzen
    Apr 2, 2004
  2. j0mbolar

    opinions on logical OR variation

    j0mbolar, Sep 28, 2004, in forum: C Programming
    Replies:
    3
    Views:
    297
    Tim Rentsch
    Sep 29, 2004
  3. yanyo

    standard variation

    yanyo, Oct 6, 2005, in forum: C Programming
    Replies:
    1
    Views:
    940
    Alexei A. Frounze
    Oct 6, 2005
  4. Alison Bowes
    Replies:
    2
    Views:
    76
    Gunnar Hjalmarsson
    Feb 18, 2005
  5. king
    Replies:
    5
    Views:
    173
Loading...

Share This Page