in reply to Read Directory

-d BUS will not do what you think it does. It checks (in an arcane way) for a directory named "BUS", but in the current directory, not in the directory denoted by $path.

Maybe you simply want to use the full path directly?

if( -d "$path/BUS" ) { ... }

Replies are listed 'Best First'.
Re^2: Read Directory
by shmem (Chancellor) on May 26, 2017 at 07:09 UTC
    It checks (in an arcane way) for a directory named "BUS", but in the current directory

    Sorry, no. BUS is just a bareword here with no meaning whatsoever for -d.

    perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

      Had I tested my assumption, I would have come to that same conclusion:

      perl -we "print -d SCRIPTS" Name "main::SCRIPTS" used only once: possible typo at -e line 1. -d on unopened filehandle SCRIPTS at -e line 1. Use of uninitialized value in print at -e line 1.

      I thought the bareword would be treated as a string, but it gets treated as a filehandle.

      That's what I get for not using the old ways but lexical filehandles wherever I can :).