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 would always return true.
> So use if (-d "/home/user"){ 
> and you would know the problem. 
> 
> >     print"1\n";
> >}
> >  
> >
> 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 do you think so???

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to