Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: hash of hashes

by marinersk (Priest)
on Oct 07, 2013 at 07:09 UTC ( [id://1057229]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    C:\Steve\Dev\PerlMonks\P-2013-10-06@2342-Hash-Of-Hashes>FruitColor1b.p
    +l
    strawberry red green rose
    ...
    key = 'green'   subkey = 'strawberry'
    key = 'red'   subkey = 'strawberry'
    key = 'red'   subkey = 'apple'
    
  2. or download this
    use strict;
    use warnings;
    
  3. or download this
    my %hash = ();
    
  4. or download this
    for ($i = 1;$i <= $#line;$i++)
    {
    ...
        $hash{$d}{$i}=$line[$i];
        print "$hash{$d}{$i}\n";
    }
    
  5. or download this
    {apple}{1} = 'red'
    {apple}{2} = 'green'
    
  6. or download this
    {apple}{red}
    {apple}{green}
    
  7. or download this
    foreach my $color (@colors)                # Was:  for ($i = 1;$i <= $
    +#line;$i++)
    {
        $hash{$color}{$fruit} = 1;             # Was:  $hash{$d}{$i}=$line
    +[$i];
        print "Added hash{$color}{$fruit}\n";  # Was:  print "$hash{$d}{$i
    +}\n";
    }
    
  8. or download this
    }
    close (MYFILE);
    
  9. or download this
    foreach my $key (keys %hash)
    {
    ...
            print "key = '$key'   subkey = '$subkey'\n";
        }
    }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2024-04-16 09:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found