Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^4: Modules to reduce syntax?

by LanX (Sage)
on Dec 27, 2021 at 18:54 UTC ( #11139950=note: print w/replies, xml ) Need Help??


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

> perhaps a tad hyperbolic?

well you said

> > > The reduction in typing and file size from these 2 characters quickly adds up.

and that's not the case from the second level on.

This can be easily overlooked, hence my remark.

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

Replies are listed 'Best First'.
Re^5: Modules to reduce syntax?
by perlfan (Vicar) on Dec 27, 2021 at 22:02 UTC
    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.
      > 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.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2022-07-06 06:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?