package Overload::Yell; use overload '""' => sub { warn "string\n"; return 'foo' }, '0+' => sub { warn "number\n"; return 123 }, ; sub new { bless {} } package main; my $x = Overload::Yell->new(); print "yeller: $x\n"; # accessed here copier( $x ); sub copier { my $arg = shift; # accessed here print "my arg once: $arg\n"; # ...or here print "my arg twice: $arg\n"; # here? } __END__ string yeller: foo string my arg once: foo string my arg twice: foo