Solved

How to print a file

Posted on 1999-01-14
4
165 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…

832 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