Putting multiple files into 1 array?
I need to know how to put multiple files into the same array. They're all in the same directory and they're called poll1.txt, poll2.txt, poll3.txt, etc. Theirs also a file that keeps track of how many polls there are. So, how would I go about getting them into the same array?? I thought I had it, but it doesn't work.
Thanks!
--Edge
Ken Elliott posted this at 18:52 — 17th June 2000.
They have: 358 posts
Joined: Jun 1999
Well this is a simple suggestion. You could assign each file to a scalar.
$file1 = "file1.txt";
$file2 = "file2.txt"; #etc.
And then add the scalars to the array.
@files = "$file1, $file2"; #etc.
Just a simple suggestion. PERL has many ways of accomplishing the same things.
Hope it helps.
VulKen
Keepin' It Realistic
Pimpin like a pimp with an electrofied pimpin machine!
Rob Pengelly posted this at 19:04 — 17th June 2000.
They have: 850 posts
Joined: Jul 1999
The easiest way would to go
@polls = </dir/*.txt>;
This would get all the different .txt files and place them in an array.
Hope that helps.
------------------
click here to help save lives
http://www.wiredstart.com : The Technology Start Page
http://www.thehungersite.com - http://www.therainforestsite.com
http://www.ratemymullet.com - Beauty is only mullet deep.
Edge posted this at 01:20 — 19th June 2000.
They have: 117 posts
Joined: Mar 2000
Okay, I can't tell if that works yet because I think another part of my script is messing.
Is this an okay login script?
Ken Elliott posted this at 15:01 — 19th June 2000.
They have: 358 posts
Joined: Jun 1999
I am not sure if this is the problem with your script, and I am not 100% sure if I am right. But I think you need to escape those single ticks "'" (ie. I'm = I\'m). I might be wrong. I am not a professional PERL scripter, but I have yet to use the exit; key thingy. I don't know if you would need it in your script, if it is checking all of the conditions in succession.
I don't think you meant to print it like this but at the end of your script you never added anything to do to the last if statement. Also it is not closed with a curly bracket "}".
Well that is all that I can think of. If none of that works tell us what happens when all of the correct info is entered.
Pimpin like a pimp with an electrofied pimpin machine!
Ken Elliott posted this at 15:07 — 19th June 2000.
They have: 358 posts
Joined: Jun 1999
Ah man...I just wrote a whole post and couldn't post it because of flood control or something. It was more then 60 secs. Oh well here I go again. Well I guess it did add my post. I will delete this one.
[Deleted]
VulKen
Keepin' It Realistic
[This message has been edited by VulKen (edited 19 June 2000).]
Pimpin like a pimp with an electrofied pimpin machine!
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.