Creating .txt/.html file using perl script

Discussion in 'Perl Misc' started by jdblackford@gmail.com, May 12, 2007.

Guest

Hello,

I was wondering if it was possible to create simple program that will
create .txt (or .html) files based on information provided via
prompts. If so, would someone be willing to assist me with this? I
know absolutely nothing about Perl (or any other programming language
for that matter)

For instance, if I wanted to create a file called 01.20.07.html based
off of a specific date (01 is MM, 20 is DD, 07 is YY) that looked like
this:

Advertisements

wrote:
> I was wondering if it was possible to create simple program that will
> create .txt (or .html) files based on information provided via
> prompts. If so, would someone be willing to assist me with this? I
> know absolutely nothing about Perl (or any other programming language
> for that matter)
>
> For instance, if I wanted to create a file called 01.20.07.html based
> off of a specific date (01 is MM, 20 is DD, 07 is YY) that looked like
> this:

So you would like call it like

perl myprogram.pl 01 20 07 9

to produce the desired output?

> I would like to be able to enter the following information when
> prompted by the program:
> MM
> DD
> YY
> Number of images

You already had to type the program name in order
to start it, so adding the parameters directly would
simplify the program and allows to mechanize your work
later.

Or did you think of 'clicking a file in explorer and
entering info then'?
> If possible, I would like to have the code know how many table rows to
> create (in intervals of 3) based on the number of images.
> Is this something someone here can assist with?

I'm not really sure what you intend to solve and
what would be the best way to do it.

Your specification is 'proforma' (without "entering info then")
fulfilled by a short perl script like:
==>
use strict;
use warnings;
use CGI qw':standard';

On May 12, 5:45 pm, wrote:
> Hello,
>
> I was wondering if it was possible to create simple program that will
> create .txt (or .html) files based on information provided via
> prompts. If so, would someone be willing to assist me with this? I
> know absolutely nothing about Perl (or any other programming language
> for that matter)
>
> For instance, if I wanted to create a file called 01.20.07.html based
> off of a specific date (01 is MM, 20 is DD, 07 is YY) that looked like
> this:
>
> <html>
> <body>
> <table>
> <tr><td><img src="http://www.mywebsite.com/01.20.07/1.JPG">
> <td><img src="http://www.mywebsite.com/01.20.07/2.JPG">
> <td><img src="http://www.mywebsite.com/01.20.07/3.JPG">
> </tr>
> <tr><td><img src="http://www.mywebsite.com/01.20.07/4.JPG">
> <td><img src="http://www.mywebsite.com/01.20.07/5.JPG">
> <td><img src="http://www.mywebsite.com/01.20.07/6.JPG">
> </tr>
> </body>
> </html>
>
> I would like to be able to enter the following information when
> prompted by the program:
>
> MM
> DD
> YY
> Number of images
>
> If possible, I would like to have the code know how many table rows to
> create (in intervals of 3) based on the number of images.
>
> Is this something someone here can assist with?

You might want to check any Perl templating modules like TT(Template
Toolkits),

Hi, thank you for your comments. You are half right, and I just
started learning TT and am still far from touching the gory details of
this tool. :-( ....... clpm for me is pretty much like a classroom
where I practice myself and listen from others (especially those
professionals). I really apprecdiate all your input and suggestions.

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!