$hashoffiles->{$streamID}->{$filename} = (modsize, group, user etc...)
####
Can't use string ("1") as a HASH ref while "strict refs" in use at E:\Inetpub\cgi-bin\wms.pl line 176.
####
foreach my $dir (@dirList)
{
if(! -d $dir)
{
push @failDir, ($dir);
next;
}
find { wanted => sub {
#the @fileInfo array is created using the stat function but is irrelevant for perlmonks
my @fileInfo = ($mode, $user, $group, $size, $mtime, $type, $filename, $filepath);
#$hashOfStreams has two keys: 1 and 8
#Create a hash of files from source dir for each stream
foreach my $key (keys %$hashOfStreams)
{
#ie $hashOfFiles->{'1'}->{'E:/mame.txt} = [ '$mode', '$user', '$group'.. ];
#ie $hashOfFiles->{'8'}->{'E:/mame.txt} = [ '$mode', '$user', '$group'.. ];
$hashOfFiles->{$key}->{$File::Find::name} = [ @fileInfo ];
#the following Debug code prints all vars correctly
print "$key $File::Find::name $mode, $user, $group, $size, $mtime, $type, $filename, $filepath
";
}
}, follow => 0}, "$dir";
}
####
foreach $key (sort keys %$hashOfFiles)
{
#FAILS HERE - ERROR SAYS THAT $key is not a hash but a string
foreach my $file (sort keys %$key)
{
my ($mode2, $user2, $group2, $size2, $mtime2, $filename, $filepath) = @{$hashOfFiles->{$key}->{$file}};
print "$file - $filename, $filepath, $mode2 $user2, $group2, $size2, $mtime2
";
}
}