Solved

How to print a file

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

762 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

20 Experts available now in Live!

Get 1:1 Help Now