in reply to Which Data Structure Should I Be Using?
That line is an error. You're saying that a slice of a hash reference is set equal to an array reference (whose only element is an array reference, I might add). Better would be:@{$data{$ip}}{@field_names} = [$fields];
Now, you still have a problem with@{$data{$ip}}{@field_names} = @$fields;
You're saying that you want to create an array reference, pointing to an array of elements from the three arrays in order. I suspect you really want:my $fields = [@cname, @ports, @banners];
Thus, the complete code would be:my @fields = (\@cname, \@ports, \@banners);
That should do what you want. :-)my @fields = (\@cname, \@ports, \@banners); @{$data{$ip}}{@field_names} = @fields;
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Which Data Structure Should I Be Using?
by dru145 (Friar) on Apr 02, 2002 at 20:03 UTC | |
by dragonchild (Archbishop) on Apr 02, 2002 at 20:36 UTC |