Hi ALL,

I know i am missing something somewhere:


perl -e '  
                package Foo;   
                use overload q("") => sub {return shift->{bar}};   
                $s = bless{bar=>"hello"}, Foo;   
                print "$s\n" 
         '

prints "hello".


Whereas:

perl -e ' 
                package Foo;   
                use overload q("") => sub {return shift->{bar}};   
                $s = bless{bar=>"hello"},Foo;   
                $wilma = "how r u";   
                print "$wilma\n"  
         '

prints "how r u".


Why is'nt it overloading " " in the second case??. I was expecting it to again print 
"hello".


Thanx for showing me light,
-Sharad

Reply via email to