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

Building an arbitrary-depth, multi-level hash

by Anonymous Monk
on Feb 28, 2009 at 21:52 UTC ( [id://747210]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    ...
    Name=foo
    Icon=bar
    Categories=a;b;c
    ...
    
  2. or download this
    #!/usr/bin/perl -w
    use strict;
    ...
        my $val = qq#prog "$collect{name}" $collect{icon} $collect{exec}#;
    
    ### More code follows
    
  3. or download this
    # 'categories' entry is 'GNOME;Games;Action'
    push $out{GNOME}{Games}{Action}, $val;
    # 'GNOME;Games;Action;FPS'
    push $out{GNOME}{Games}{Action}{FPS}, $val;
    # ...and so on.
    
  4. or download this
        my @levels = split /;/, $collect{categories};
        for (0 .. $#levels) {
    ...
    
    use Data::Dumper;
    print Dumper($out);
    

Log In?
Username:
Password:

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

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

    No recent polls found