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

Re^3: tree-oriented query against table-oriented data

by BrowserUk (Pope)
on Jul 04, 2006 at 22:57 UTC ( #559229=note: print w/replies, xml ) Need Help??

in reply to Re^2: tree-oriented query against table-oriented data
in thread tree-oriented query against table-oriented data

Try this:

#! perl -slw use strict; use List::Util qw[ reduce ]; use Data::Dumper; my %data; while( <DATA> ) { my( $genre, $title, $fname, $lname ) = split '/'; $data{ $genre } = {} unless exists $data{ $genre }; $data{ $genre }{ $title } = [] unless exists $data{ $genre }{ $tit +le }; push @{ $data{ $genre }{ $title } }, { fname => $fname, lname => $ +lname }; }; print Dumper \%data; __DATA__ sitcom/simpsons/homer/simpson sitcom/simpsons/ned/flanders sitcom/flintstones/fred/flintstone sitcom/flintstones/wilma/flintstone sitcom/flintstones/barney/rubble gameshow/price is right/bob/barker gameshow/jeopardy/alex/trebek

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2021-03-04 13:02 GMT
Find Nodes?
    Voting Booth?
    My favorite kind of desktop background is:

    Results (104 votes). Check out past polls.