in reply to Permission denied Found to be Obsolete

At a guess, you haven't shown us all the code (where is the shebang line? Where is use strict and use warnings? etc), and that line 13 isn't "last;" but is actually "open FILE, $dir.$file or die "$! $file";", and that you have a file in the directory called "Found to be obsolete" that the user the Perl is running as doesn't have permission to read.

Replies are listed 'Best First'.
Re^2: Permission denied Found to be Obsolete
by Scarborough (Hermit) on Sep 26, 2006 at 09:18 UTC
    All correct and I have added the the comment "below is the orginal line 13" However I now have the answer.

    And its in the checking of the directory. It should read
    if($file ne '.' and $file ne '..' and ! (-d $dir.$file)){ ##code }

    A trap I should have seen I admitt but sometimes putting on here clears ones head.

      !(-d $name)
      should be
      -f $name

      After all, there's plenty of things a directory entry can be besides a plain file and a directory.

      You should probably also consider whether the name test shouldn't instead be

      $file !~ /^\./
      because, theoretically, any file whose name begins with dot is supposed to be "hidden". Of course, you may in fact want to search the hidden files as well; I don't know.

      We're building the house of the future together.