sub foo{ my $thing = shift; print $thing->to_xml; } #### void foo(bar thing){ cout << thing.to_xml(); }