Thank to Mark , Rob and Charles for your help.
I am using the following snippet of code to check if the directory is empty
and it is working. But I still cannot understand the line my $count = () =
readdir $dh;
Can anybody explain whats the use of the = ( ) = ?
Thanks
Jair
sub IsEmptyDir {
my ( $directory) = @_ ;
return undef unless -d $_[0];
opendir my $dh, $_[0] or die $!;
my $count = () = readdir $dh;
return $count - 2;
}
----- Original Message -----
From: "Mark G" <[EMAIL PROTECTED]>
To: "Jair Santos" <[EMAIL PROTECTED]>
Cc: "perl" <[EMAIL PROTECTED]>
Sent: Thursday, June 05, 2003 9:09 PM
Subject: Re: Is empty directory?
>
> ----- Original Message -----
> From: "Jair Santos" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, June 05, 2003 7:00 PM
> Subject: Is empty directory?
>
>
> > Hi all,
> >
> > does anybody knows how to check if a diretory is empty?
>
> You can open it {opendir } and see for your self {readdir}
>
> Mark G
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]