Previous Thread
Next Thread
Print Thread
Rate Thread
#101239 09/22/2000 3:51 PM
Joined: Sep 2000
Posts: 138
Em8
Offline
Member
Member
Offline
Joined: Sep 2000
Posts: 138
How would I take a .txt file and use a script to open it up and take whats in the .txt file and turn all of that into a $ varible? Thanks. I'm trying to mess with alot of my scripts and I need to know how to do this.

Thanks!

------------------
Wanna See A Real BB?...So your on one, But heres another!

This message has been edited by Em8 on September 22, 2000 at 03:54 PM

Sponsored Links
#101240 09/22/2000 3:57 PM
Joined: Sep 2000
Posts: 755
P.I.T.A. / Programmer
P.I.T.A. / Programmer
Offline
Joined: Sep 2000
Posts: 755
Turn all fo that into a variable how?

As:
my $var = [entire contents of the file];

or:
file contains:
blah = 1
blah2 = cheese

and you want your program to now have
$blah with a value of 1
and $blah2 with a value of 'cheese'?

--mark


"Annnnnnnndd now, opening for Iron Maiden...... WYLD STALLYNS!!!" --Bill S. Preston, Esquire and Ted "Theodore " Logan
#101241 09/22/2000 9:13 PM
Joined: Sep 2000
Posts: 138
Em8
Offline
Member
Member
Offline
Joined: Sep 2000
Posts: 138
I dunno if that was it but any way, I wan't to make a script and to make it easier on people who don't know perl, they type in the cuss word in the .txt file instead of looking for the varibles.

so badw.txt contains:
Code
code:

How would I take all that into a single $ like $badwords in another CGI script?

------------------
...........

This message has been edited by Em8 on September 22, 2000 at 09:14 PM

#101242 09/22/2000 10:19 PM
Joined: Sep 2000
Posts: 755
P.I.T.A. / Programmer
P.I.T.A. / Programmer
Offline
Joined: Sep 2000
Posts: 755
It would be better for you to structure your file as:

bad1
bad2
bad3
bad4

then just do:

Code
code:

You now have your words in the @bad_words array which you can check against your data.

Andy: No, I still wouldn't slurp. But if its a small file, then this is one instance where I don't get too mad at people for doing it [Linked Image]

--mark


"Annnnnnnndd now, opening for Iron Maiden...... WYLD STALLYNS!!!" --Bill S. Preston, Esquire and Ted "Theodore " Logan
#101243 09/22/2000 10:21 PM
Joined: Aug 2000
Posts: 3,590
Moderator
Moderator
Offline
Joined: Aug 2000
Posts: 3,590
[Linked Image]

------------------
Da Wannabe Cannuck

Sponsored Links
#101244 09/23/2000 11:33 AM
Joined: Sep 2000
Posts: 138
Em8
Offline
Member
Member
Offline
Joined: Sep 2000
Posts: 138
Thanks![Linked Image][Linked Image][Linked Image][Linked Image][Linked Image][Linked Image]

------------------


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)