Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6705129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:22:05+00:00 2026-05-26T07:22:05+00:00

Hi how can I read this information using template toolkit $var1= { ‘STC’=>[ {

  • 0

Hi how can I read this information using template toolkit

 $var1= {  
  'STC'=>[
     {
        'gym'=>{
              'hyd'=>{
                   'com'=>[
                        'dr'=>'1', 
                         'typ'=>'z',
                          'bemo'=>{
                               'bm'=>'1',
                                'typ'=>'x',
                                'col'=>'red'
                                 }
                               } 
                            {
                          'dr'=>'12', 
                         'typ'=>'a',
                          'bemo'=>{
                               'bm'=>'25',
                                'typ'=>'p',
                                'col'=>'red'
                                 }
                            } 
                         {
                          'dr'=>'23', 
                         'typ'=>'k',
                          'bemo'=>{
                               'bm'=>'22',
                                'typ'=>'w',
                                'col'=>'blue'
                                 }
                            } 
                          {
                          'dr'=>'3', 
                         'typ'=>'s',
                          'bemo'=>{
                               'bm'=>'9',
                                'typ'=>'B',
                                'col'=>'green'
                                 }
                            } 

                          }
                       }
                      ]
                     };

I am not able to get this type of complex data , Remaining everything I solved and I am getting output as I want but this problem suffers me.please help me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:22:06+00:00Added an answer on May 26, 2026 at 7:22 am

    ok so you have some data, what do you expect it to look like? At the risk of sounding snarky, you could simply open in a text editor and print pdf or save as rtf. Clearly this isn’t what you mean.

    You need to format the data somehow. Then the conversion will simply be the application of that your data to that format.

    As I mention here, you could make a LaTeX template and fill it in with your data and Template::Toolkit and compile using a LaTeX compiler. This would get you a PDF.

    #!/usr/bin/env perl
    
    use strict;
    use warnings;
    
    use XML::Fast;
    use Template;
    
    my $xml = <<'XML';
     <student>
          <number>24</number>
          <education>bachelors</education>
          <specialization>computers </specialization>
         -<address>
             <house_number="128"/>
             <street name="xxxx"/>
               <proddutoor/>
          <address/>
         -<details>
              <name="clar"/>
              <age="20"/>
             <sex="m"/>
           </details>
    </student>
     <student>
          <number>23</number>
          <education>ph.d.</education>
          <specialization>physics </specialization>
         -<address>
             <house_number="128"/>
             <street name="xxxx"/>
               <proddutoor/>
          <address/>
         -<details>
              <name="joel"/>
              <age="20"/>
             <sex="m"/>
           </details>
    </student>
    XML
    my $xml_hash = xml2hash $xml;
    
    my $template = Template->new();
    
    my $filename = 'output.tex';
    
    #I think the following is a holdover from a previous version
    #as I cannot check right now, I will leave as a comment:
    #open my $fh, '>', $filename;
    
    $template->process(\*DATA, $xml_hash, $filename)
        || die "Template process failed: ", $template->error(), "\n";
    
    system( "pdflatex $filename" );
    
    __DATA__
    \documentclass{article}
    
    \title{Roster}
    \author{pavani}
    
    \begin{document}
    \maketitle
    
    [% FOREACH st IN student %]
    Student [% st.number %] is a [% st.specialization %] [% st.degree %] student.
    
    [% END %]
    
    \end{document}
    

    N.B. XML::Fast even does surprisingly well against your poorly formatted XML 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I read the X and Y DPI information from an image using
You can read this question where I ask about the best architecture for a
I can read settings like this, for example: final String mytest = System.getString(this.getContentResolver(), System.AIRPLANE_MODE_ON);
I read this article where Ayende states NHibernate can (compared to EF 4): Collection
This is a question you can read everywhere on the web with various answers:
I've read this question, but I want to know how can I delete the
I have a VS project with an IntermediateDirectory like this: ....\temp\$(SolutionName)\$(ProjectName). I can read
I am sure I read about this the other day but I can't seem
I've read a couple of posts on this issue but still can't seem to
I have read that you can do it, but would this really improve performance

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.