Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: how to name an anonymous reference

by Anonymous Monk
on Dec 17, 2017 at 22:09 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1205753]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (7)
As of 2024-04-18 09:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found