Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
#!/usr/bin/perl -CSDA use utf8; use Modern::Perl; no warnings qw{uninitialized}; use Data::Dumper; my $tables = { # hash ref "{", keys are day numbers 0 => { # day0 confirmed => [1, 0.334638642561918, 2, 0.8733077785172 +49, 0.8539438, 57158699], deaths => [], }, 1 => { # day1 confirmed => [2, 0.334538642561918, 2, 0.8733077785172 +49, 0.8539438, 57158699], deaths => [], }, 2 => { confirmed => [3, 0.334638442561918, 2, 0.8733077785172 +49, 0.8539438, 57158699], deaths => [], }, }; $$tables{3}{confirmed} = [3, 0.18, 2, 0.849, 0.8, 59]; $$tables{3}{deats} = [2, 3, 4]; $$tables{4} = { confirmed => [4, 1.3, 2, 1.9, 2, 57], deaths => [], }; $$tables{1}{deats}[3] = "three"; $$tables{1}{deats}[5] = "five"; $$tables{5}{alfa} = ["a", "l", "faaaaa"]; for my $d (keys %$tables) { print "\nnext day... $d\n"; for my $t (keys %{$$tables{$d}}) { print "day is $d, table is \"$t\", content: ", (join " +, ", @{$$tables{$d}{$t}}), "\n"; } } print "Dumper is: ", Dumper($tables);

result:

next day... 4 day is 4, table is "confirmed", content: 4, 1.3, 2, 1.9, 2, 57 day is 4, table is "deaths", content: next day... 0 day is 0, table is "confirmed", content: 1, 0.334638642561918, 2, 0.87 +3307778517249, 0.8539438, 57158699 day is 0, table is "deaths", content: next day... 2 day is 2, table is "confirmed", content: 3, 0.334638442561918, 2, 0.87 +3307778517249, 0.8539438, 57158699 day is 2, table is "deaths", content: next day... 1 day is 1, table is "deats", content: , , , three, , five day is 1, table is "confirmed", content: 2, 0.334538642561918, 2, 0.87 +3307778517249, 0.8539438, 57158699 day is 1, table is "deaths", content: next day... 5 day is 5, table is "alfa", content: a, l, faaaaa next day... 3 day is 3, table is "deats", content: 2, 3, 4 day is 3, table is "confirmed", content: 3, 0.18, 2, 0.849, 0.8, 59 Dumper is: $VAR1 = { '4' => { 'confirmed' => [ 4, '1.3', 2, '1.9', 2, 57 ], 'deaths' => [] }, '0' => { 'confirmed' => [ 1, '0.334638642561918', 2, '0.873307778517249', '0.8539438', 57158699 ], 'deaths' => [] }, '2' => { 'confirmed' => [ 3, '0.334638442561918', 2, '0.873307778517249', '0.8539438', 57158699 ], 'deaths' => [] }, '1' => { 'deats' => [ undef, undef, undef, 'three', undef, 'five' ], 'confirmed' => [ 2, '0.334538642561918', 2, '0.873307778517249', '0.8539438', 57158699 ], 'deaths' => [] }, '5' => { 'alfa' => [ 'a', 'l', 'faaaaa' ] }, '3' => { 'deats' => [ 2, 3, 4 ], 'confirmed' => [ 3, '0.18', 2, '0.849', '0.8', 59 ] } };

In reply to Re: accessing an anonymous array by leszekdubiel
in thread accessing an anonymous array by WoodyWeaver

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-04-19 15:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found