http://qs1969.pair.com?node_id=11139953


in reply to Re^4: Modules to reduce syntax?
in thread Modules to reduce syntax?

The -recurse option to h2o creates accessors for all levels of hash; though I have not tried to see if it works for something like,
my $ref = { foo => { bar => [ baz => 1, herp => 2, derp => 3 ], }, };
Or maybe I don't know what you mean by, from the second level on.

Replies are listed 'Best First'.
Re^6: Modules to reduce syntax?
by LanX (Sage) on Dec 27, 2021 at 22:33 UTC
    > Or maybe I don't know what you mean by, from the second level on.

    Your first level deref with H2O

    $ref->foo

    is 2 characters shorter than

    $ref->{foo}

    but that's it!

    No more gains for further levels

    $ref->foo->$bar->baz->bla

    vs

    $ref->{foo}{$bar}{baz}{bla}

    is still only 2 characters better.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

    ) hypothesized, I've never used or tested this.