The program below works, but I don't believe I have to make the
reference # my $svgs = \...@svgs; to get it into the hash;
I think I should be able to do something like
$folders{$folder} = @svgs;
print "$folders{Ztyx}->[3]\n";
But can't get my head around how to do it (The error message ...
Can't use string ("4") as an ARRAY ref while "strict refs" in use ..)
should tell me something, but I'm not sure what.
Where am I wrong?
TIA
Owen
=========================================
#!/usr/bin/perl
use strict;
my @folders = grep -d, <*>; # 1000 odd directories
my %folders;
foreach my $folder (@folders) {
opendir( my $DB_DIR, $folder ) or die "Can't open $folder $!\n";
my @svgs =
grep { /\.svg?/ } readdir($DB_DIR);
close $DB_DIR;
my $svgs = \...@svgs;
$folders{$folder} = $svgs;
}
print "@{$folders{Ztyx}}[3] \n"; #
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/