...
if (-e $path) {
if (-l $path) {
print "is a link";
} elsif (-d _) {
print "is a direcotry \n";
} elsif (-f _) {
print "Is a file";
} else {
print "Error";
}
}
####
if (-e $path) {
if (-l $path) {
print "is a link";
} elsif (-d $path) {
print "is a direcotry \n";
} elsif (-f $path) {
print "Is a file";
} else {
print "Error";
}
}
####
#!/opt/perl_5.8.7/bin/perl
use Benchmark qw(:all);
my $path = "test.lnk";
my $coderef = sub {
if (-e $path) {
if (-l $path){
print "path is link \n";
} elsif (-d _) {
print "Path is directory \n";
} elsif (-f _) {
print "Path is file \n";
}
}
};
my $coderef1 = sub {
if (-e $path) {
if (-l $path){
print "path is link \n";
} elsif (-d $path) {
print "Path is directory \n";
} elsif (-f $path) {
print "Path is file \n";
}
}
};
my $r = cmpthese( 50000000, {
statreuse => $coderef->(),
nostatreuse => $coderef1->()
});