BostonGuru
03-14-2007, 10:56 PM
I wrote a program in php which includes the function is_dir() which returns whether the specified path is a directory (1) or a file (0). I now need to translate it into perl, however I have been unable to find the comparable function for PERL. Does anyone know if one exists, and if so, what is it?
dexxtreme
03-16-2007, 05:10 AM
Well, in perl you can run it through an "if" statement:
sub is_dir() {
if ( -d $_[0] ) { return 1; } else { return 0; }
}
BostonGuru
03-16-2007, 01:21 PM
thank you very much for the reply.
If i read in a directory's contents (currently using perl on OS X) the only items that -d labels as a directory are "." and "..". None of the subfolders are returned as a directory.
OverlordQ
03-17-2007, 01:06 AM
If -d doesn't work theres most likely a bug in your script.