Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: how to name an anonymous reference

by Anonymous Monk
on Dec 17, 2017 at 22:09 UTC ( #1205753=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1205753]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2020-01-18 11:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?