I'm totally new here. Can someone provide me a short Perl script and its corresponding config file so that i can compare and base on it as my pattern? I appreciate the help, thanks.
I included a simple Factorial program (perl script) below with output to be printed in a text file.. -
$out="C:/0718/";
-
print "Please specify what type of file you want to create : ";
-
chop ($inp=<STDIN>);
-
print "What number to factor ? : ";
-
chop ($num=<STDIN>);
-
open OUT, ">$out$inp" or die "Cannot open $out for write :$!";
-
-
$j=1;
-
for ($i=1;$i<=$num;$i++)
-
-
{$j=$j*$i;
-
print OUT "$j \t$i\n";}
-
print OUT"The factorial of $num is $j \n";
-
-
print "Ok you can now check $out$inp \n";
-
Thanks very much!
Monster
5 2224
First, the use of code tags is required in the forums. Please use them to surround any and all code that you place in your posts. This is your warning.
As for your request, this is a learning forum, not a scripting service. If you are just wanting someone to write the script for you, then please feel free to post a job opening in the Jobs forum and hopefully someone will take it if the pay is right.
Otherwise, you can post the code you have tried in order to do what you ask, if it isn't working, and we can assist you in getting it working, all the while, you can learn some Perl.
Also, what does the factorial script have to do with your request?
Regards,
Jeff
Do you have something that needs to read/write a configuration file? There are modules like Config::General and Config::Simple for that purpose but I am not sure if you mean an actual configuration file or something else. It is also inappropriate to PM members seeking personal assistance or quicker than normal replies to your questions. Makes me suspicious that this is school/class work, which is not allowed to be posted here.
First of all, thanks for the responses. Sorry for the confusion though.. I just want to know what does a config file do within a Perl script. I know this is something that a programmer can edit without creating any problem on the actual script? The reason I provided the simple factorial program is for me to know how to link a config file there. Yes Kevin, i think I need an actual config file for that simple script. Later on, I can do it myself once I got familiar on how the config file works against it.
Thanks Guys.
Monster
First of all, thanks for the responses. Sorry for the confusion though.. I just want to know what does a config file do within a Perl script. I know this is something that a programmer can edit without creating any problem on the actual script? The reason I provided the simple factorial program is for me to know how to link a config file there. Yes Kevin, i think I need an actual config file for that simple script. Later on, I can do it myself once I got familiar on how the config file works against it.
Thanks Guys.
Monster
You are correct! A config file is a place to put values that may or do change. That way, you can change them at will without having to change the script. The more complex your script is, the less you really want to edit it.
The format of the config file is up to you but there are modules (as Kevin pointed out) to process them. One module that we use where I work is called "Config::Scoped". Its a rather complex module, but the possibilities with it will amaze you. Personally, if you are just beginning with config files, the modules Kevin mentioned would be better. Or, if you wish, you can process them yourself, as I have done many times.
Regards,
Jeff
Thanks Jeff, i'll take your advice. i will ask questions again once I bumped into an issue.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: ferg |
last post by:
I've checked all the FAQs and help - spent a couple of hours on this
now and it's really bugging me.
I've got Moin 1.3.5 installed on IIS 5.0.
I can view and edit pages without any problems, but...
|
by: David Elliott |
last post by:
I can create this:
?xml version="1.0" standalone="yes" ?>
<ConfigOpt>
<record>
<Field_1>Text # 1</Field_1>
<Field_2>Text # 2</Field_2>
</record>
</ConfigOpt>
|
by: Vicky via DotNetMonster.com |
last post by:
Hi,
Could anyone help me with some info how to create app.config file.
I need to put code of directory info in there, Thank you very much!
DirectoryInfo di = new DirectoryInfo("C:\\Vicky...
|
by: Rich |
last post by:
Hello,
I picked up this example on using the Reflection namespace
for loading forms/classes on the fly at msdn
http://msdn.microsoft.com/library/default.asp?...
|
by: Madhu |
last post by:
All,
New to DB2 environment. Can someone share a script that can be used to
a create a DB2 UDB database manually. I am trying to create a database
on Linux, single partition.
Thanks
Madhu
|
by: mlafarlett |
last post by:
Geez...seems like i've compared every friggin character...works n this
programA but not n programB. I have a config file with multiple
sections and when trying to read each section, it works great...
|
by: James Johnston |
last post by:
I've never written a Python program before and I'm trying to read a config
file with file path/names (eg. c:\\python24\\*.dll, ... *.exe) to create an
output file of filename + md5 values. I'm...
|
by: forest demon |
last post by:
I need to be able to create an appender to direct output to a
MessageBox.
The API does not have a MessageBox appender like nLog does. What
would be the easiest way to do this. The examples...
|
by: Ronald S. Cook |
last post by:
Currently (manually), I 1) open a Windows SDK Command Prompt and 2) navigate
to a particular folder. Then I 3) type a command and press enter. The
command is irrelevant (WCF-related) but here it...
|
by: Christian Muggli |
last post by:
can someone explain me how to create a app.config file during runtime? i see
two ways:
- add a skeleton of an app.config file to the exe/dll and extract it during
runtime as a resource and...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |