Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: Recursively walk a hash to get to an element

by ikegami (Patriarch)
on Apr 04, 2021 at 19:47 UTC ( [id://11130821]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use Data::Diver qw( DiveVal );
    
    ...
      -or-
    my %branch;
    DiveVal(\%branch, map \$_, @keys) = 'leaf';
    
  2. or download this
    sub DiveVal :lvalue {
       my $p = \shift;
    ...
      -or-
    my %branch;
    DiveVal(\%branch, @keys) = 'leaf';
    
  3. or download this
    Pre-loop:          $p references $branch
    After loop pass 0: $p references $branch->{level1}
    After loop pass 1: $p references $branch->{level1}{level2}
    After loop pass 2: $p references $branch->{level1}{level2}{level3}
    Returned:          $branch->{level1}{level2}{level3}
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-19 02:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found