I'm trying to reference an object's method. The object is $o, the method is foo_edit. The trouble is foo is a value in $bar. $o->$bar."_edit"() fails. What's the correct ()'s and {}'s to make this work?
If i do my $b=$bar."_edit" and $o->$b() it works, but I don't wanna make temp vars like that.
{$o}->{$bar."_edit"}() fails (undefined &main::).
$o->{$bar."_edit"}() fails (undefined &main::).
$o->"${bar}_edit"() fails (syntax near ->"${c}_edit").
Who can enlighten me on this mystery?
In reply to object ref syntax by jhanna
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |