Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: A "simple" question regarding accessing a value in a complex data structure.

by AlexTape (Monk)
on Oct 09, 2013 at 08:36 UTC ( #1057509=note: print w/replies, xml ) Need Help??


in reply to A "simple" question regarding accessing a value in a complex data structure.

after fixing the brackets like choroba introduced,
i would access and travel the hash like this..
#!"C:\perl\bin\perl.exe" -w # pragma use strict; use warnings; use diagnostics; # includes use Data::Dumper; use Data::Diver qw( Dive ); # data my ( $tgs, %tgs ); %tgs = ( 'articles' => { 'Java' => 'How to Program in Java', 'Perl' => 'Perl Programming for Biologists', 'Python' => { 'Programming' => q/Expert's Guide to +Scala/, }, }, 'eBooks' => { 'Linux' => q/Linux: A Beginner's Guide/, }, ); $tgs = \%tgs; # dive hash print Dumper $tgs->{articles}->{Python}->{Programming}; # returns: # # $VAR1 = 'Expert\'s Guide to Scala'; # # or # print Dumper Dive( $tgs, qw ( articles Python Programming ) ); # returns: # # $VAR1 = 'Expert\'s Guide to Scala'; 1;
kindly perlig

$perlig =~ s/pec/cep/g if 'errors expected';
  • Comment on Re: A "simple" question regarding accessing a value in a complex data structure.
  • Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2022-09-29 14:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (125 votes). Check out past polls.

    Notices?