in reply to how to name an anonymous reference

sub ULONG () { 9 } sub ENUM () { 23 } my @annotations = ( [ "id", [ ULONG, "value", undef ] ], [ "autoid", [ ENUM, "AutoidKind", [ "SEQUENTIAL", "HASH" ] ], [ 'fixme', "value", "HASH" ] ] ); $annotations[1][2][0] = $annotations[1][1]; use Data::Dump; dd @annotations; __END__ do { my $b = [ "autoid", [23, "AutoidKind", ["SEQUENTIAL", "HASH"]], ['fix', "value", "HASH"], ]; $b->[2][0] = $b->[1]; (["id", [9, "value", undef]], $b); }
but that's ugly - XY Problem?

Replies are listed 'Best First'.
Re^2: how to name an anonymous reference
by omkellogg (Novice) on Dec 17, 2017 at 22:52 UTC
    Oops, I guess I posted too early - there is a simple workaround:
    my $ref; # auxiliary to declaring @annotations my @annotations = ( [ "id", [ ULONG, "value", undef ] ], [ "autoid", $ref = [ ENUM, "AutoidKind", [ "SEQUENTIAL", "HASH" +] ], [ $ref, "value", "HASH" ] ] );
    Sorry for the noise.