|
Posted by Ben Morrow on March 9, 2008, 5:09 am
Please log in for more thread options
> >
> > a[0]->idx = 1; # or => 1?
> > a[0]->name = "foo";
> > a[0]->loc = "earth";
>
> It was probably more like
>
> $a[0]->=1;
>
> It could also have been (unlikely)
>
> $a[0]->idx(1);
It *could* also have been
$a[0]->idx = 1;
using something like
{
package My;
my $idx;
sub idx : lvalue method { $idx }
}
my @a = bless [], 'My';
This construction is considered a bad idea nowadays, as it's very hard to
insert a proper 'set' method later.
Ben
|