Perl

Moderators: Jonathan
Number of threads: 1259
Number of posts: 3644

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Searching for a simple method... Posted by FluidMotion on 23 Aug 2003 at 12:33 PM
Hello, I have recently gotten the responsibility of creating my kung fu kwoons website. Given I am a C++ programmer, I have no interest in PERL, as you probably have the oppisite opinion. I am searching for an apparently simple method to take the characters in a text file, and put it into the html document.

I was using javascript, but many dependancies and abiguities between shtml, javascript and a piece of java I am using have forced me to use CGI. I would be very pleased if you could help me out. Thanks!
Report
Re: Searching for a simple method... Posted by WaltP on 23 Aug 2003 at 7:49 PM
: Hello, I have recently gotten the responsibility of creating my kung fu kwoons website. Given I am a C++ programmer, I have no interest in PERL, as you probably have the oppisite opinion. I am searching for an apparently simple method to take the characters in a text file, and put it into the html document.
:
: I was using javascript, but many dependancies and abiguities between shtml, javascript and a piece of java I am using have forced me to use CGI. I would be very pleased if you could help me out. Thanks!

What I did in this case is:
1) create a template that makes each page identical in look with no content
2) create text files with the content for each page
3) write a C++ program to merge the content into the template and output each HTML page
4) upload to the site

----------------
Walt


Report
Re: Searching for a simple method... Posted by Jonathan on 24 Aug 2003 at 9:14 AM
: Hello, I have recently gotten the responsibility of creating my kung
: fu kwoons website. Given I am a C++ programmer, I have no interest in
: PERL, as you probably have the oppisite opinion. I am searching for
: an apparently simple method to take the characters in a text file,
: and put it into the html document.
:
: I was using javascript, but many dependancies and abiguities between
: shtml, javascript and a piece of java I am using have forced me to
: use CGI. I would be very pleased if you could help me out. Thanks!

OK, the following script opens a text file and puts it amongst some HTML code.

#!/usr/bin/perl

#Read in file.
open my $fh, "< path/to/file.txt";
my $file = join('', <$fh>);
close $fh;

#Print HTTP header.
print "Content-type: text/html\n\n";

#Print page file contents in it.
print qq{
<html>
<b>File Contents</b><br>
$file
</html>
};


Hope this helps,

Jonathan

###
for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
(tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
/(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.