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.
> >>    
> >>
> >
> >What? You mean like:
> >
> >     if (-d "$dir") { ...
> >
> >Why do you think so???
> >
> Nothing in particular.. 
> Sometimes I use 
> if(-d $dir/test){
> ... This fails
> 
> 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 variable:
        if (-d "$dir") { ...
Unless you really really know why.

:-)
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