in reply to Re^7: How can I call a Perl sub with an object from a sub name stored in a var?
in thread How can I call a Perl sub with an object from a sub name stored in a var?
> Any defined-but-non-coderef value is stringified
Correction: any "non-coderef value is stringified" , even undef is stringified to an empty string. ( It's just tricky to create a sub for an empty symbol. :)
DB<199> $obj = bless {},"tmp" DB<200> $tmp::{''} = sub { say "empty" } DB<201> $meth = undef DB<202> $obj->$meth empty DB<203>
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^9: How can I call a Perl sub with an object from a sub name stored in a var?
by tobyink (Canon) on Dec 10, 2020 at 12:05 UTC |
In Section
Seekers of Perl Wisdom