How to optimize perl code for directory exists or not ?
- by SCNCN2010
sub DirectoryExists {
my $param = shift;
# Remove first element of the array
shift @{$param};
# Loop through each directory to see if it exists
foreach my $directory (@{$param}) {
unless (-e $directory && -d $directory) {
return 0;
}
}
# True
return 1;
}
is there any way to optimize this code ?
is there any good way to optimize this code