Solved

How to print a file

Posted on 1999-01-14
4
154 Views
Last Modified: 2010-03-05
How should I print a file through a SSI HTML document.
<!-- exec cgi="myfile.cgi" -->

and this output goes like this

if date = 01 then
print file=/home/www/mydir/dates-dir/01.html
if date = 02 then
print file=/home/www/mydir/dates-dir/02.html

where the 02.html is going to be inserted as a content inside of the of a SSI HTML document on the fly.

if possible can you show some Perl code to accomplish this task?

Thank you,
 
0
Comment
Question by:elvaaa
  • 2
  • 2
4 Comments
 

Author Comment

by:elvaaa
ID: 1207545
Adjusted points to 50
0
 
LVL 5

Expert Comment

by:thoellri
ID: 1207546
#!/usr/local/bin/perl
$date=[ I don't know where you get the date from? ];
$file="/home/www/mydir/dates-dir/".sprintf("%02d",$date).".html";
die "Can't read $path - $!" unless -r $file;
open(F,"<$file");
while(<F>) {
   # You can do some more stuff here with the file
   print;
}
close(F);

Hope this helps
  Tobias

0
 

Author Comment

by:elvaaa
ID: 1207547
YES thank you thoellri! It does work. Post an answer! You are great!
0
 
LVL 5

Accepted Solution

by:
thoellri earned 50 total points
ID: 1207548
Answer above ....

Cheers
  Tobias
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
sort hash by values desc 2 185
perl script to check whether folder contains any files 5 77
Check file date before getting folder path 1 64
Perl script to delete older files 6 69
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now