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
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.
> >>
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
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
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
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
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
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
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