mjd-perl-pm on Tue, 25 Apr 2000 15:59:12 -0400 (EDT)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Perl 5.6 question


> Perl 5.6 question: Why would you want to use an lvalue sub?

Suppose you have an object, $car.  $car has a piece of member data
called `color'.

        $the_color = $car->color();

This gets the car's color.

        $car->color() = 'blue';

This sets the car's color to blue.  Ooops, no it doesn't, unless you
have perl 5.6.0 and you said that the `color' function was :lvalue.
Otherwise, it's just a syntax error.

**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**