Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2018-03-21 09:16 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (265 votes). Check out past polls.