Michael G Schwern <[EMAIL PROTECTED]> writes:
>
>    print "Today's weather will be $weather->temp degrees and sunny.";
>    
>This does not DWIM.  Instead of interpolating C<$weather->temp> as a method
>call, it comes out as C<$weather.'->temp'> and is usually followed immediately
>by the question "What does 'Weather=HASH(0x80d4174)->temp' mean??"  Most
>programmers learning OO Perl expect this to work and are surprised to find
>that it does not.

I think $xxxx-> is unlikely enough in a string that this is worth considering.

>
>Work arounds abound:

     print $weather->report;

being the one I like best - avoids the un-meritted assumption 
it will be sunny ;-)



-- 
Nick Ing-Simmons <[EMAIL PROTECTED]>
Via, but not speaking for: Texas Instruments Ltd.

Reply via email to