Hi, "TSa (Thomas Sandlaß)" wrote: > Ingo Blechschmidt wrote: >> Or did you simply forget the braces around 42? :) > > No, it was intented for seeing what the reactions will be :)
:) > Just using &foo as unsigiled variable. This might need > > my &foo is rw; I don't think this will DWYW, as firstly "is rw" is the default on vars declared with my(), and secondly &foo will be undef, not some kind of Proxy object. To do what you want, you'd have to write (I think): my &foo = new_codeless_lvalue_sub(); sub new_codeless_lvalue_sub { my $var; return { new Proxy: FETCH => { $var }, STORE => -> $new { $var = $new }; }; } > But then I presume you could say: > > foo = 17; > if foo < 8 > { > @a[foo] = 8; > } > > We could call that a codeless lvalue sub ;) This indeed looks very slick! I wouldn't use it for normal vars, though. --Ingo -- Linux, the choice of a GNU | The next statement is not true. generation on a dual AMD | The previous statement is true. Athlon! |