I couldn't really see what the problem was with the code you quoted, so I wrote a short test script and passed it through Perl.
#! perl
use warnings;
use strict;
my $allDirArray = [{dir => "b"},{c => "d"}];
my $i = 0;
my $tempDir = ${$allDirArray}[$i]{'dir'};
print "$tempDir\n";
As written above, using Perl 5.10 on Cygwin, the program ran as followed:
$ perl allarraydir.pl
b
No error message was printed. See http://codepad.org/pH4eyMlt
Edit
After including telemachus's suggestion, I added the following code to the end of the above program,
# The following addition was included re telemachus's comment
my @allDirArray2 = ({dir => "b"},{c => "d"});
$tempDir = ${$allDirArray2}[$i]{'dir'};
print "$tempDir\n";
ran it again and got the following error message:
$ perl allarraydir.pl
Global symbol "$allDirArray2" requires explicit package name at
allarraydir.pl line 10.
Execution of allarraydir.pl aborted due to compilation errors.
(this should really be a comment on your question rather than an answer, but the code is too long.)