If you have a array of hashes where the key represents the column name and the value is the row content what would be the best way to output this as a table in perl?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Does each row have the same hash keys? That’s the structure you would get, e.g. from DBI, corresponding to the generally understood properties of tables (i.e. each row has the same set of columns). Here’s a sample of what I have in mind, and I hope it matches what you’re thinking:
In such cases you normally know what the columns are. I’m going to make that assumption. Here, then, is the code: