Hey Perl'ers,
I can't seem to print the array reference within the struct correctly
( I get a blank rather than the expected data).
I grabbed this idea Chapter 12, pg 336 of Programming Perl and it looks
like I followed their sample but something doesnt seme to be working
correctly.
Cheers,
#!/usr/bin/perl -w
use strict;
use Parse::RecDescent;
use Class::Struct;
select ( STDOUT );
$| = 1;
# my $wRX = "\[\\w\\-\]";
# my $commentRX = qr/^--/;
struct Object => {
name => '$',
id => '$',
children => '@',
};
my @MIB_TREE;
my $node = Object->new();
$node->name("Murray");
$node->id("ID3148");
$node->children(["Craig", "Scott", "Cara"]);
push @MIB_TREE, $node;
$node = Object->new();
$node->name("CRAIG");
$node->id("ID0281");
$node->children(["NA"]);
push @MIB_TREE, $node;
foreach my $object ( @MIB_TREE ){
print $object->name."\n";
print $object->id."\n";
print @{$object->children}; #< - Does not print children correctly
print "\n";
};
-----------------------------------------
Craig Moynes
IBM Global Services, Canada
[EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]