You're calling both instances of glob
in scalar context (but not as an iterator) which is very wrong. For example,
my $foo = glob("a");
my $bar = glob("a");
say $foo // "[undef]"; # a
say $bar // "[undef]"; # [undef]
The glob language is completely different than the regex language. \d
won't work, but [0123456789]
would.
my @dir_paths = glob("./abc/dir-[0123456789].[0123456789].[0123456789]/my-dir*");
die "No match!" if !@dir_paths;
die "Too many matches!" if @dir_paths > 1;
my $dir_path = $dir_paths[0];