|Perl: the Markov chain saw
Parse config file into data strucuture and pass it between pages in CGI scriptby sara2005 (Scribe)
|on Sep 17, 2005 at 12:57 UTC
sara2005 has asked for the wisdom of the Perl Monks concerning the following question:
i have a data file in the following format:-
it goes on for several pages (may be, 20 at the max)
i decided to use array of hashses to hold the data. the logic is i read a line, if 'Page' is encountered, i store that in an array and get the page count, then, between [start] to [end], i read everything into a hash and push that into an array. note that i also add the 'Page' entry into the hash before pushing it into an array of hashes.
i was able to print the data for a given page after it was read successfully but my question is
(1) I want to create an input page with the data for a given page. is this a good approach?
(2) I need to be able to send the array of hashes from one page to another in CGI. (the logic is to have the complete data for various pages stored in an array of hashes with the pagenum and then decode it to build the input page for the selected one) Is it doable?
I would appreciate any suggestions.. (am i over-complicating things? one reason i went for this approach is bcoz i don't want to create a very complicated 3-tier or 4-tier structure!! but i am looking forword to you experts to tell me what is acceptable- obviously, i am new to Perl)
Thanks for the earlier tips using which i got a good start..
here is the code i wrote to decode the above data