On Tue, 2008-09-30 at 17:30 +0300, Vyacheslav Karamov wrote:
> Hi All!
>
> I need to pass object to a function. How can I do it?
>
> How to make this code work?
>
> use Tree::Simple;
>
>
> sub SomeFunc
> {
> my $node = @_;
> foreach my $child ($node->getAllChildren() )
> {
> ...
> }
> }
> my $tree = Tree::Simple->new("tree", Tree::Simple->ROOT);
>
> SomeFunc( $tree );
>
>
>
$tree contains a reference to an object of type Tree::Simple. Like any
reference you can pass it around as you please.
To see what's inside $tree, use Data::Dumper
use Data::Dumper;
print '$tree : ', Dumper $tree;
--
Just my 0.00000002 million dollars worth,
Shawn
Linux is obsolete.
-- Andrew Tanenbaum
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/