Call a function from string variable in PERL, PHP and C#


my $function_name = "hello";
function hello() {
my $param = shift;
print "hello $paramn";


$function_name = "hello";
function hello($param) {
echo "hello $paramn";


class Program
static void Main(string[] args)
Type type = typeof(MyReflectionClass);
MethodInfo method = type.GetMethod("Hello");
MyReflectionClass c = new MyReflectionClass();
method.Invoke(c, null);

public class MyReflectionClass
public void Hello(int num)
Console.WriteLine("hello {0}", num.ToString());

Spread the word. Share this post!

Leave A Reply

Your email address will not be published.