CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
opening a file with the name of what they entered

 



Killian
Deleted

Apr 27, 2001, 10:34 PM

Post #1 of 2 (143 views)
opening a file with the name of what they entered Can't Post

I am trying to make my script check to see if a txt file already exists, if it does, do one thing, if it doesn't do another.

The problem is I want it to check if "whatever-they-typed-into-the-form.txt" exists.

I have put the info into an associatie array so to check what they typed in I just do $associative_array{'name'} and it shows what they typed in for the name field on the form.

I have tried the following:

if (-e '$associativearray{'name'}.txt')
{
do thing a
}
else
{
do thing b
}

but every time i do this is does thing b even when I have a file called moo.txt and I type in moo for the name field... what am I doing wrong?



zanardi
journeyman

Apr 27, 2001, 11:24 PM

Post #2 of 2 (140 views)
Re: opening a file with the name of what they entered [In reply to] Can't Post


Code
if (-e "$associativearray{'name'}.txt")

the way you had it, you were actually searching for a file named $associativearray{'name'}.txt.

----------------------
Fueled By ZCom

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives