in reply to compound structure? 4way-hash
One thing on which i would like to hear your comment is the while cycles ... did u see "my $h", if i try this :...... sub parse { my $self = shift; #parse the classes my @clases = $$self{_data} =~ /class\s+?"(.+?)"\s+?\{.*?=\s*(.+?)\s*; +/gs; while ($#clases > 0) { $$self{_clases}{pop @clases} = pop @clases; } my @hosts = $$self{_data} =~ / host\s*(.+?)\s*\{.*? filename\s*"(.+?)"\s*;.*? ethernet\s*(.+?)\s*;.*? fixed-address\s*(.+?)\s*; /xgs; while ($#hosts > 0) { my $h = shift @hosts; ($$self{_hosts}{$h}{file}, $$self{_hosts}{$h}{mac}, $$self{_hosts}{$h}{ip}) = splice @hosts,0,3; } } sub name2 { my ($self, $name, $to) = @_; $$self{_hosts}{$name}{$to} } 1;
it wont work... not a big deal but it is interesting to know why ?(my $h, $$self{_hosts}{$h}{file}, $$self{_hosts}{$h}{mac}, $$self{_hosts}{$h}{ip}) = splice @hosts,0,4;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: compound structure? 4way-hash
by Aristotle (Chancellor) on Aug 26, 2002 at 15:52 UTC |