i guess, this will not exist, because it is actually a combination of querying data from a database and displaying the result.
That is one way of evaluating the problem, however it is possible to 'rethink' the situation if you strip away pre-existing paradigms, methodologies, and ask the following:
Given this:
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
What can I use to transform it into this?:
$dataroot = {
'gameshow' => {
'price is right' => [
{
'lname' => 'barker',
'fname' => 'bob'
}
],
'jeopardy' => [
{
'lname' => 'trebek',
'fname' => 'alex'
}
]
},
'sitcom' => {
'simpsons' => [
{
'lname' => 'simpson',
'fname' => 'homer'
},
{
'lname' => 'flanders',
'fname' => 'ned'
}
],
'flintstones' => [
{
'lname' => 'flintstone',
'fname' => 'fred'
},
{
'lname' => 'flintstone',
'fname' => 'wilma'
},
{
'lname' => 'rubble',
'fname' => 'barney'
}
]
}
};
The key consideration here is a simple question of transforming the flat 'row-based' representation into a 'nested representation'. This does not necessarily involve a database at all. Nor does it necessarily involve 'displaying' anything (unless you count using Data::Dumper to show the output for illustrative purposes only).
=oQDlNWYsBHI5JXZ2VGIulGIlJXYgQkUPxEIlhGdgY2bgMXZ5VGIlhGV
-
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.