Brent 'Dax' Royal-Gordon wrote:

Juerd <[EMAIL PROTECTED]> wrote:

There is no way to get an anonymous rw scalar, is there?


There's always the Perl 5 hack:

    \do { my $x }

Although that's not truly anonymous, I suppose.

There's a less-well-known hack that *is* truly anonymous:

    $anon_scalar_ref = \eval{undef};

Or, of you prefer your anonymous scalar initialized:

    $anon_scalar_ref = \eval{ $init_val };


However, in A6 (http://dev.perl.org/perl6/doc/design/apo/A06.html#Digression_on_types),
Larry muses:

    Though for the closure case, it's possible we could define some kind
    of non-my article to introduce a type unambiguously:

        $closure = a Camel sub ($name) {...}
        $closure = an Aardvark sub () {...}

    Presumably "a" or "an" is short for "anonymous". Which is more or
    less what the indefinite article means in English.


So presumably, one could also envisage:

    $anon_scalar_ref = a Scalar;

Damian


Reply via email to