in reply to monitoring directory for new subdirectories

If the plan is to run a script at some interval (e.g. via your crontab), and you just want to monitor a single directory (not recursively watching all existing subdirectories), something like this would be pretty quick:
use Croak qw/croak/; # (update; don't forget this line, if making a m +odule) sub check_new_paths { my ( $chkpath, $reflist ) = @_; # path to monitor, list of prev. + contents my %old_list; if ( -f $reflist ) { open( LST, "<", $reflist ) or croak( "Can't read $reflist: $!" + ); %old_list = map { chomp; $_ => undef } <LST>; close LST; } if ( ! -d $chkpath ) { croak( "$chkpath is not a directory" ); } my @new_list = grep { -d } <$chkpath/*>; # NB: file glob does not catch "$chkpath/.any-dot-initial-dirnam +e" my @added_list; if ( keys %old_list ) { for my $p ( sort @new_list ) { push @added_list, $p unless exists( $old_list{$p} ); } } else { warn sprintf( "Creating new list %s with %d items\n", $reflist, scalar @new_list ); } open( LST, ">", $reflist ) or croak( "Can't write $reflist: $!" ); print LST "$_\n" for ( @new_list ); close LST; return @added_list; }
If you need to recursively check subdirs within the target path, you'll want to check out one of the various "File::Find" modules -- or just do something like:
my @new_list = split /\x0/, `find $chkpath -type d -print0`;
(which will also give you subdir names that begin with "."). -- Update: I'm sure you can get File::Glob to list dot-initial file names, too, but "that is left as an exercise..." ;)

But if you can get Linux::Inotify to work (shouldn't be too hard), it'll probably include better, more general tools that you'll want to use.