UBB.Dev
Posted By: Em8 .txt transfer - 09/22/2000 10:51 PM
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
Posted By: Mark Badolato Re: .txt transfer - 09/22/2000 10:57 PM
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
Posted By: Em8 Re: .txt transfer - 09/23/2000 4:13 AM
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
Posted By: Mark Badolato Re: .txt transfer - 09/23/2000 5:19 AM
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
Posted By: The Team Re: .txt transfer - 09/23/2000 5:21 AM
[Linked Image]

------------------
Da Wannabe Cannuck
Posted By: Em8 Re: .txt transfer - 09/23/2000 6:33 PM
Thanks![Linked Image][Linked Image][Linked Image][Linked Image][Linked Image][Linked Image]

------------------
© UBB.Developers