Hello,

GS>I have a Perl scalar ($mystr) that holds a string. I want to use the
GS>scalar to form a hash reference to a method after the Perl code is
GS>compiled.

I'm not sure exactly what you're trying to do with this, but here's two
things that can help you.

Perl allows you to delay resolution of a method until run-time:

    $method = 'foo';
    $object->$method($a, $b, $c)

Perl also allows you to form closures that encapsulate a method of an
existing object instance:

    $method_sub = sub { $object->foo(@_) };

In your case it sounds like you want to combine the two.

    $method = $foo;
    $method_sub = sub { $object->$method(@_) };
    return $method_sub;

Hope that helps.

Humbly,

Andrew

----------------------------------------------------------------------
Andrew Ho               http://www.tellme.com/       [EMAIL PROTECTED]
Engineer                   [EMAIL PROTECTED]          Voice 650-930-9062
Tellme Networks, Inc.       1-800-555-TELL            Fax 650-930-9101
----------------------------------------------------------------------

Reply via email to