How do I call a function name that is stored in a hash in Perl?

后端 未结 3 1853
情深已故
情深已故 2020-12-10 16:00

I\'m sure this is covered in the documentation somewhere but I have been unable to find it... I\'m looking for the syntactic sugar that will make it possible to call a metho

3条回答
  •  [愿得一人]
    2020-12-10 16:33

    Foo->${\$hash{func}};
    

    But for clarity, I'd probably still write it as:

    my $method = $hash{func};
    Foo->$method;
    

提交回复
热议问题