On 12/30/05, S Khadar <[EMAIL PROTECTED]> wrote:
> $dir = shift;
> $dir ="/home/trial";

You seem to be over-writing what you just put into $dir. (I think this
is just your debugging code, though.)

> opendir(M,"$dir");

Just as when using open(), it's important to check for errors with
opendir() by using "or die". The double quote marks around the
variable name are superfluous.

    opendir(M, $dir) or die "Can't opendir '$dir': $!";

> $dmchk=zless(  "$dir/$_/foo.gz");
>
> if (-z "$dmchk")

That test is looking to see whether the file named by $dmchk is a
zero-byte file. (Again, the double quote marks are superfluous around
a simple scalar name.) So, if that variable contains "fred", and
there's an empty file named fred in the current directory, it returns
true. That's probably not what you meant to do. (Did you want to use
regular expressions to examine the content of $dmchk?)

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to