Re: function name in a variable

2016-08-09 Thread Brandon Allbery
On Tue, Aug 9, 2016 at 3:49 AM, Theo van den Heuvel wrote: > I have string variable and want to execute a function with that name. How > do I call that function? > > sub bar { say "Hi" } > my $subname = 'bar'; > > # how to call the sub whose name I have? >

function name in a variable

2016-08-09 Thread Theo van den Heuvel
Hi all, I have seen this somewhere in the docs, but can't find it for the life of me. I have string variable and want to execute a function with that name. How do I call that function? sub bar { say "Hi" } my $subname = 'bar'; # how to call the sub whose name I have? "$name".();