Re: Verify that a directory exists.

2005-02-28 Thread Ankur Gupta
So its better to use if(-d "$dir/test") { I see. Well I would not call this good practice. You simply have to quote the string literal. Or construct it via concatenation: if(-d ($dir . "/test")) { I would use the first form. Anyway my point was that you should not quote a simple vari

Re: Verify that a directory exists.

2005-02-28 Thread Jenda Krynicky
From: Ankur Gupta <[EMAIL PROTECTED]> > >>Also, if you are hard coding the path then you need to quote them if > >>(-d "/home/user"){ if you are using a variable then if (-d $dir){ > >>would work. But its always a good practice to quote > >>filenames/directories , even if they are variables. > >>

Re: Verify that a directory exists.

2005-02-28 Thread Ankur Gupta
Also, if you are hard coding the path then you need to quote them if (-d "/home/user"){ if you are using a variable then if (-d $dir){ would work. But its always a good practice to quote filenames/directories , even if they are variables. What? You mean like: if (-d "$dir") { ... Why

Re: Verify that a directory exists.

2005-02-28 Thread Jenda Krynicky
From: Ankur Gupta <[EMAIL PROTECTED]> > Carlos Mantero wrote: > >Hi, I tested the code in my little script but the "if" bucle with the > >verify of the directory don't work fine, always print 1. > > > >if ("-d /home/user") { > > > "-d /home/user" is a string and not a test of directory. > So it wou

Re: Verify that a directory exists.

2005-02-28 Thread Wiggins d'Anconia
Carlos Mantero wrote: El lun, 28-02-2005 a las 14:49 +0300, Vladimir D Belousov escribió: 1) if (-d $DIR_NAME) { directory exists }; 2) if((lstat($DIR_NAME))[1] & 004) { directory exists and it is the real directory (not the symbolic link) }else{ ... No such direc

Re: Verify that a directory exists.

2005-02-28 Thread Ankur Gupta
Carlos Mantero wrote: El lun, 28-02-2005 a las 14:49 +0300, Vladimir D Belousov escribió: 1) if (-d $DIR_NAME) { directory exists }; 2) if((lstat($DIR_NAME))[1] & 004) { directory exists and it is the real directory (not the symbolic link) }else{ ... No such di

Re: Verify that a directory exists.

2005-02-28 Thread Carlos Mantero
El lun, 28-02-2005 a las 14:49 +0300, Vladimir D Belousov escribió: > 1) >if (-d $DIR_NAME) { > directory exists > }; > > 2) > if((lstat($DIR_NAME))[1] & 004) { > directory exists and it is the real directory (not the > symbolic link) > }else{ > ... No su

Re: Verify that a directory exists.

2005-02-28 Thread Vladimir D Belousov
1) if (-d $DIR_NAME) { directory exists }; 2) if((lstat($DIR_NAME))[1] & 004) { directory exists and it is the real directory (not the symbolic link) }else{ ... No such directory or it is symbolic link }; Carlos Mantero wrote: Hi all, I'm a begginer in Perl and

RE: Verify that a directory exists.

2005-02-28 Thread Mallik
if (-d ) { print "Directory exists\n"; } -Original Message- From: Carlos Mantero [mailto:[EMAIL PROTECTED] Sent: Monday, February 28, 2005 5:09 PM To: Perl BG Subject: Verify that a directory exists. Hi all, I'm a begginer in Perl and other programming languages. I want to veri