php forum
php mysql forum
php mysql smarty
 
Topic Options
#102939 - 07/05/01 07:10 AM incluzion of .txt filez
Baby Jordan Offline
Member

Registered: 11/07/00
Posts: 32
how du u include a .txt file within a perl script?
_________________________
Yourz truly
Baby Jordan

"Tell theze BadBoy luvvin' b*tchez 2 bring it on"

Top
#102940 - 07/05/01 08:27 AM Re: incluzion of .txt filez
tackaberry Offline

Pooh-Bah

Registered: 11/28/00
Posts: 3234
Loc: NYC | 100% Hockey
If by include, you mean to read-in an external file, you would use the Open command.

open FILEHANDLE, EXPR


-Tacks
_________________________

Top
#102941 - 07/05/01 11:54 PM Re: incluzion of .txt filez
The Donut Offline
Member

Registered: 03/17/00
Posts: 236
Loc: Amarillo, Texas
if that file has extra info that helps the script run, then use:

require "file.txt";


and call the contents of the file like it was part of the sub your in.

or if you just want to display the contents of the text file, use something like:

open (FILE, "file.txt") or die "cannot open file.txt: $!";
$text = <FILE>;
close(FILE);

print "$text";

Note to Borg(if you ever read this): perl ubb code tags don't work well if you have two instances in the same post. prints the last instance in all the instances.

<FONT COLOR="#000000" SIZE="1">[ July 05, 2001 11:57 PM: Message edited by: The Donut ]</font>
_________________________
-Never Underestimate The Power Of Stupid People In Large Groups.

Top
#102942 - 07/27/01 04:48 PM Re: incluzion of .txt filez
CNCR Offline
Member

Registered: 03/23/01
Posts: 337
Loc: UK
there is no need to require the file...
_________________________

do NOT request graphics via my email, either PM me, or Make a request on the forums.

Top
#102943 - 07/27/01 04:49 PM Re: incluzion of .txt filez
CNCR Offline
Member

Registered: 03/23/01
Posts: 337
Loc: UK
and if the file had CGI in it, you would still be printing it out as text, not executing the CGI. (duh)
_________________________

do NOT request graphics via my email, either PM me, or Make a request on the forums.

Top
#102944 - 08/01/01 05:01 PM Re: incluzion of .txt filez
The Donut Offline
Member

Registered: 03/17/00
Posts: 236
Loc: Amarillo, Texas
Well, if you use require(), then it is executing, not printing, given that the file you're requiring is written in Perl also. It would print as text only if you used the open() method.

I remember this very well, because in php, if you require() or include() a file, if ther are no <? or ?> tags, then it prints it as text. Perl doesn't work that way. You ever notice how ubb treats files when it require()'s them? wink smile

Just pointing that out..

[ August 01, 2001: Message edited by: The Donut ]
_________________________
-Never Underestimate The Power Of Stupid People In Large Groups.

Top



Latest Posts
[7.2.1] - Naked shoutbox
by bellaonline
05/05/12 05:00 PM
[7.x] Stop Forum Spam Integration v0.4
by bellaonline
05/05/12 03:53 PM
Shout Box

(Views)Popular Topics
Known public proxy servers 1689885
Integrated Index Page (IIP) 5.3.1 555705
Finished-[6.5.2] Games Arcade Deluxe v1.9 501236
Integrated Index Page (IIP) 5.1.1 415112
TLD Bv2.1 Released - Threads Links Directory 396822
[6.0x] Who's Online 4.0.0 [Finished] 389412
Finished-[6.5.1] Integrated Index Page (IIP) 6.5 330423
Q & A 298663
Slash UBB 266936
[6.3.x] [beta] Hit Hack 2.0 227970
Forum Stats
13621 Members
59 Forums
37191 Topics
295716 Posts

Max Online: 686 @ 06/28/07 07:04 AM

 

 

 
fusionbb message board php hacks