in reply to array references
my @array=@{$neighbours{$domain}};
As @{...} is an array dereference, it would appear that $neighbours{$domain} is undefined. I can't tell more without seeing your input (and desired output), but you could at least bandage this with something like:
for my $domain(@domain){ next unless exists $neighbours{$domain}; my @array=@{$neighbours{$domain}};
Of course, this explicitly skips any element of @domain where %neighbours is uninitialized, which may be problematic for your case. You might also consider something like:
for my $domain(@domain){ my @array=exists $neighbours{$domain} ? @{$neighbours{$domain}} : +();
where this second option silently swallows domain misses. See perlreftut for more on references.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: array references
by Anonymous Monk on Jul 29, 2011 at 19:09 UTC | |
by kennethk (Abbot) on Jul 29, 2011 at 20:20 UTC | |
by Anonymous Monk on Jul 29, 2011 at 20:42 UTC | |
by Anonymous Monk on Jul 29, 2011 at 20:48 UTC | |
by kennethk (Abbot) on Jul 29, 2011 at 22:48 UTC |