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: Intermediate:
test existance of files...help!!!! im dying aahhhh

 



fridge
Novice

Dec 8, 2002, 6:26 PM

Post #1 of 2 (348 views)
test existance of files...help!!!! im dying aahhhh Can't Post

Crazyim jigged

i need help

cansomeone tell me how to test if a file exists ( in the same direstory as th perl script), if it does, print off some html, if it doesn't, print off soem different html.


ive already got as far as storing the filename im after in the varyable $file_01 but thats all, everything else ive tries to de just screws up... ahhhh....Crazy


davorg
Thaumaturge / Moderator

Dec 9, 2002, 12:53 AM

Post #2 of 2 (344 views)
Re: [fridge] test existance of files...help!!!! im dying aahhhh [In reply to] Can't Post


Code
if (-e $file_01) { 
# file exists - do something
} else {
# file doesn't exist - do something else
}


See perldoc -f -X for more details.

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks

 
 


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

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