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 8934785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:51:45+00:00 2026-06-15T09:51:45+00:00

Hi So I created the following script for outputing to a wiki page. The

  • 0

Hi So I created the following script for outputing to a wiki page. The problem is that I am not sure in how to format my output. Here is my code:

    #!/usr/bin/perl
use strict;
use warnings;
use POSIX qw/strftime/;
#use warnings;
my $TOTALIOS = 'totalios';
my $READP = 'readpe';
my $CACHEP = 'cachehit';
my $CKBSEC = 'currentkb';
my $MKBSEC = 'maximumkb';
my $CIOSEC = 'currentio';
my $MIOSEC = 'maxio';
my $DATESTORE = 'dates.sec';
my $DATECMD = strftime "%m/%d/%y", localtime;
my $TIOS = 'Tios';
my $READp = 'readp';
my $CACHEp = 'cachep';
my $CKBsec = 'ckbsec';
my $MKBsec = 'mkbsec';
my $CIOsec = 'ciosec';
my $MIOsec = 'miosec';
my ($STORENUM, $STORENAME, $IMGPREFIX, $MONTH, $DAY, $YEAR) = &mysubinput;
sub mysubinput
{
    print "Enter the number for the datastore: \n";
        my $STORENUM = <STDIN>;
        chomp($STORENUM);
        print "Enter the name for the datastore e.g: DataStore or ServerStore: \n";
        my $STORENAME = <STDIN>;
        chomp($STORENAME);
        print "Enter the data store image prefix e.g. datastore or serverstore: \n";
        my $IMGPREFIX = <STDIN>;
        chomp($IMGPREFIX);
        print "Enter the month MM: \n";
        my $MONTH = <STDIN>;
        chomp($MONTH);
        print "Enter the day DD: \n";
        my $DAY = <STDIN>;
        chomp($DAY);
        print "Enter the Year YYYY: \n";
        my $YEAR = <STDIN>;
        chomp($YEAR);
    return ($STORENUM, $STORENAME, $IMGPREFIX, $MONTH, $DAY, $YEAR);
#   print "$STORENUM $STORENAME $IMGPREFIX $MONTH $DAY $YEAR\n";
#   print "Not a very interesting routine\n";
#   print "This does the same thing every time\n";
#   print "$TOTALIOS\n";
#   print "Enter the number for the datastore: \n";
#   $line = <STDIN>;
#   chomp($line);
#   print "$line\n";
#   print "$DATECMD\n";
}
sub writedate 
{
    print "! $DATECMD\n";   
}    

sub writesections(mysubinput())
{

    print "| [[File:$STORENAME-$STORENUM-$TIOS-$MONTH-$DAY-$YEAR.png| 100px]]\n";
    print "| [[File:$STORENAME-$STORENUM-$READp-$MONTH-$DAY-$YEAR.png| 100px]]\n";
    print "| [[File:$STORENAME-$STORENUM-$CACHEp-$MONTH-$DAY-$YEAR.png| 100px]]\n";
    print "| [[File:$STORENAME-$STORENUM-$CKBsec-$MONTH-$DAY-$YEAR.png| 100px]]\n";
    print "| [[File:$STORENAME-$STORENUM-$MKBsec-$MONTH-$DAY-$YEAR.png| 100px]]\n";
    print "| [[File:$STORENAME-$STORENUM-$CIOsec-$MONTH-$DAY-$YEAR.png| 100px]]\n";
    print "| [[File:$STORENAME-$STORENUM-$MIOsec-$MONTH-$DAY-$YEAR.png| 100px]]\n";
}   

sub writepage
{
    &mysubinput;
    print "Go back to [[MD3000i-Perf]] \n";
    print "{| border=1 cellspacing=5 cellpadding=2 style=text-align: center \n";
    print "|-\n";
    print "! [[DataStore-1]]\n";
    print "! [[DataStore-2]]\n";
    print "! [[DataStore-3]]\n";
    print "! [[DataStore-4]]\n";
    print "! [[DataStore-5]]\n";
    print "! [[DataStore-6]]\n";
    print "! [[DataStore-7]]\n";
    print "! [[DataStore-8]]\n";
    print "! [[DataStore-9]]\n";
    print "|-\n";
    print "| [[File:disk.png |60px]]\n";
    print "| [[File:disk.png |60px]]\n";
    print "| [[File:disk.png |60px]]\n";
    print "| [[File:disk.png |60px]]\n";
    print "| [[File:disk.png |60px]]\n";
    print "| [[File:disk.png |60px]]\n";
    print "| [[File:disk.png |60px]]\n";
    print "| [[File:disk.png |60px]]\n";
    print "| [[File:disk.png |60px]]\n";
    print "|}\n";
    print "{| border=1 cellspacing=5 cellpadding=2 style=text-align: center\n";
    print "|-\n";
    &writedate;
    print " |-\n";
    &writesections;
    print " |-}\n";
}
#&mysubinput;
&writepage;
#&mysubinput;
#&writesections;

Using this approach things seem to work. However, my input is not 100% right. I have to input all my data twice, before the program can spit somthing ….

Enter the number for the datastore:
1
Enter the name for the datastore e.g: DataStore or ServerStore:
DataStore
Enter the data store image prefix e.g. datastore or serverstore:
datastore
Enter the month MM:
12
Enter the day DD:
03
Enter the Year YYYY:
2012
Enter the number for the datastore:
1
Enter the name for the datastore e.g: DataStore or ServerStore:
DataStore
Enter the data store image prefix e.g. datastore or serverstore:
datastore
Enter the month MM:
12
Enter the day DD:
03
Enter the Year YYYY:
2012
Go back to [[MD3000i-Perf]]
{| border=1 cellspacing=5 cellpadding=2 style=text-align: center
|-
! [[DataStore-1]]
! [[DataStore-2]]
! [[DataStore-3]]
! [[DataStore-4]]
! [[DataStore-5]]
! [[DataStore-6]]
! [[DataStore-7]]
! [[DataStore-8]]
! [[DataStore-9]]
|-
| [[File:disk.png |60px]]
| [[File:disk.png |60px]]
| [[File:disk.png |60px]]
| [[File:disk.png |60px]]
| [[File:disk.png |60px]]
| [[File:disk.png |60px]]
| [[File:disk.png |60px]]
| [[File:disk.png |60px]]
| [[File:disk.png |60px]]
|}
{| border=1 cellspacing=5 cellpadding=2 style=text-align: center
|-
! 12/04/12
        |-
| [[File:DataStore-1-Tios-12-03-2012.png| 100px]]
| [[File:DataStore-1-readp-12-03-2012.png| 100px]]
| [[File:DataStore-1-cachep-12-03-2012.png| 100px]]
| [[File:DataStore-1-ckbsec-12-03-2012.png| 100px]]
| [[File:DataStore-1-mkbsec-12-03-2012.png| 100px]]
| [[File:DataStore-1-ciosec-12-03-2012.png| 100px]]
| [[File:DataStore-1-miosec-12-03-2012.png| 100px]]
        |-}

Things seem to work now after adding this variable to ‘my’

my ($STORENUM, $STORENAME, $IMGPREFIX, $MONTH, $DAY, $YEAR) = &mysubinput;

second piece was to add
return ($STORENUM, $STORENAME, $IMGPREFIX, $MONTH, $DAY, $YEAR);

Now my questions is how do i get the output from sub writesections into a file, such as datastore.wk?

  • 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-15T09:51:46+00:00Added an answer on June 15, 2026 at 9:51 am

    Do not ever comment the use strict line 🙂

    It would alert you that your writesections sub doesn’t have the access to the variables declared inside the scope of mysubinput!

    I suggest you to learn about private variables first. To share your variables, you should return them. Following your logic:

    sub mysubinput
    {
        ...
        return ($STORENUM, $STORENAME, $IMGPREFIX, $MONTH, $DAY, $YEAR);
    }
    
    my ($STORENUM, $STORENAME, $IMGPREFIX, $MONTH, $DAY, $YEAR) = mysubinput();
    writesections($STORENAME, $STORENUM, $MONTH, $DAY, $YEAR);
    

    However, if you expect to grow your Perl script, sooner or later you’ll have to learn Object-Oriented Programming. Then, Moose framework is your friend.

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

Sidebar

Related Questions

I've created the following script that searches the page for any instances of Two
Based on the helpful answers I received here , I created the following script,
I'm new to Postgres and SQL. I created the following script that draws a
I am hoping that you can help me. I have created the following script,
I created the following script to query a table and return the first 30
I created a lightbox using the following script: <script type=text/javascript> $(document).ready(function(){ $(.BtnAction).click(function(){ var objPopup
Based on a similar casestudy I've created the following bit of script to reveal/hide
I have created a file called untitled1.cpp in dev-cpp with the following script: #include
I thought the following script will create div element but I got nothing output
I have the following script. The created background job never finishes. (It finishes in

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.