By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,852 Members | 2,220 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,852 IT Pros & Developers. It's quick & easy.

Check to see if file exsists (perl running on vista)

P: 67
Hey I'm trying to see if a file exsists but I'm using windows, I know in Linux you can use -e but that doesn't seem to work for me in windows.

Expand|Select|Wrap|Line Numbers
  1.     if (-e $filename)
  2.     {
  3.         print "File Doesn't Exist!";
  4.     }     
  5.  
Mar 10 '09 #1
Share this Question
Share on Google+
1 Reply


KevinADC
Expert 2.5K+
P: 4,059
Your example is logically reversed, it should be:

Expand|Select|Wrap|Line Numbers
  1.  
  2.     if (-e $filename)
  3.     {
  4.         print "File Exists!";
  5.     }     
  6.  

-e works on Windows.
Mar 10 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.