Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using the -d test operator in perl

Tags:

perl

I'm going through someone's old code and I came across this statement:

$tmpStr = "/some/file/location/";

if(-d $tmpStr){
   printf("1");
}else{
   printf("2");
}

I'm confused about what the -d does... any help?

like image 497
poy Avatar asked Jun 23 '11 14:06

poy


1 Answers

-d returns true if the following string is a directory.

See -X in perlfunc.

like image 191
Qtax Avatar answered Oct 04 '22 17:10

Qtax