How to call a subroutine with a scaler with

Discussion in 'Perl Misc' started by blaine@worldweb.com, Jan 19, 2009.

  1. Guest

    Hi,

    I would like to call a subroutine without using an eval statement that
    has a scaler in the context.


    ie.
    my $class = FakeClass->new();
    my $type = $class->GetType();

    $class->DoSomething_$type();


    Any ideas?
    , Jan 19, 2009
    #1
    1. Advertising

  2. J. Gleixner Guest

    wrote:
    > Hi,
    >
    > I would like to call a subroutine without using an eval statement that
    > has a scaler in the context.
    >
    >
    > ie.
    > my $class = FakeClass->new();
    > my $type = $class->GetType();


    my $method = "DoSomething_$type";
    >
    > $class->DoSomething_$type();


    $class->$method();
    J. Gleixner, Jan 19, 2009
    #2
    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. Casey
    Replies:
    3
    Views:
    842
    Casey
    Jan 30, 2004
  2. Alison Bowes
    Replies:
    0
    Views:
    461
    Alison Bowes
    Feb 18, 2005
  3. WC Justice

    Call VBA subroutine from ASP

    WC Justice, Sep 27, 2004, in forum: ASP General
    Replies:
    1
    Views:
    280
    Bob Barrows [MVP]
    Sep 27, 2004
  4. sdfgsd
    Replies:
    11
    Views:
    147
    sdfgsd
    Nov 6, 2003
  5. king
    Replies:
    5
    Views:
    170
Loading...

Share This Page