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

  • Home
  • SEARCH
  • 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 9168101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:33:06+00:00 2026-06-17T15:33:06+00:00

I have a perl script that outputs monthly statistics from a database. These are

  • 0

I have a perl script that outputs monthly statistics from a database. These are summarised in a table using the following snippet of code

print $fh <<END; 
This report details clinical and imaging statistics from $date_start to $date_stop.

\\large \\bf Clinical Statistics

\\normalsize \\rm 

\\begin{table}[h]
\\centering 
\\begin{tabular}{p{4cm}cccccccc} 
\\hline
  & $operator[0] & $operator[1] & $operator[2] & $operator[3] & $operator[4] & $operator[5] & $operator[6] & $operator[7] \\\\
\\hline

    Cannulations & $venflons[0] & $venflons[1] & $venflons[2] & - & $venflons[4] & $venflons[5] & $venflons[6] & $venflons[7] \\\\
    Clinical Assessments & $clin_ass[0] & $clin_ass[1] & $clin_ass[2] & - & $clin_ass[4] & $clin_ass[5] & $clin_ass[6] & - \\\\
    Lead Stressor & $etlead[0] & $etlead[1] & $etlead[2] & - & $etlead[4] & $etlead[5] & $etlead[6] & $etlead[7] \\\\
    Assistant Stressor & $etass[0] & $etass[1] & $etass[2] & - & $etass[4] & $etass[5] & $etass[6] & - \\\\
    ECG Preparation & $ecg_prep[0] & $ecg_prep[1] & $ecg_prep[2] & $ecg_prep[3] & $ecg_prep[4] & $ecg_prep[5] & $ecg_prep[6] & - \\\\Patient Identification & $patient_id[0] & $patient_id[1] & $patient_id[2] & $patient_id[3] & $patient_id[4] & $patient_id[5] & $patient_id[6] & - \\\\
    \\hline
    \\end{tabular}
    \\end{table}

    END

Basically the perl script queries various tasks for each operator and stores the number of counts in each field. Operator is a perl array and is likely to change size by 1 or 2 values, i.e is likely It is likely that the operator array may change with time (i.e new initials added or removed). In such cases I would have rewrite the latex table part of my script i.e adding $operator[8] etc. I’m sure there is a more sensible approach to this problem using loops but I can’t work out how to achieve this.

Any ideas?

  • 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-06-17T15:33:08+00:00Added an answer on June 17, 2026 at 3:33 pm

    Define a function, which prints a row

    sub print_row
    {
        my($fh) = shift;
        print $fh join(' & ', @_), "\\\\\n";
    }
    

    This function prints a row to $fh, composed of all arguments to print_row. If you want more columns printed, just give more arguments.

    Now use this in your table

    print $fh <<END; 
    This report details clinical and imaging statistics from $date_start to $date_stop.
    
    \\large \\bf Clinical Statistics
    
    \\normalsize \\rm 
    
    \\begin{table}[h]
    \\centering 
    \\begin{tabular}{p{4cm}cccccccc} 
    \\hline
    END
    
    print_row($fh, '', @operator);
    print $fh "\\hline\n";
    print_row($fh, 'Cannulations', @venflons, '-');
    print_row($fh, 'Clinical Assessments', @clin_ass, '-');
    print_row($fh, 'Lead Stressor', @etlead);
    print_row($fh, 'Assistant Stressor', @etass, '-');
    print_row($fh, 'ECG Preparation', @ecg_prep, '-');
    print_row($fh, 'Patient Identification', @patient_id, '-');
    
    print $fh <<END; 
    \\hline
    \\end{tabular}
    \\end{table}
    
    END
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Perl script that takes text values from a MySQL table and
I have a perl script that pulls serialized php data from a database, unserializes
I have a Perl script that uses WWW::Mechanize to read from a file and
I currently have a Perl CGI script that parses incoming XML requests using XML::Simple
I have a plain perl script that can be run from the command-line via
I have a Perl script that parses an Excel file and does the following
I have the following Perl script that generates a string based on a number:
I have a Perl script that outputs some colored text under bash. For example,
I have a perl script that calls an other perl script by using system()
I have a Perl script that outputs text. I want to import this text

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.