Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Combining Branches in Trees

by Lexicon (Chaplain)
on May 06, 2004 at 07:54 UTC ( #351017=note: print w/ replies, xml ) Need Help??


in reply to Combining Branches in Trees

Just to be thorough, I thought I'd include some testing code to give more hints as to how this is supposed to work.

#!/usr/bin/perl use warnings; use strict; use Data::Dumper; # Be sure to copy the subroutine code into here. my @tree1 = ( [ [ 'red', 'orange', 'yellow', undef, undef, + undef ], [ undef, undef, undef, 'cyan', 'magent +a', 'black' ] ], [ [ 'red', undef, 'yellow', undef, 'magent +a', undef ], [ undef, 'orange', undef, 'cyan', undef, + 'black' ] ], ); my @done =( [ [ 'red', 'orange', 'yellow', 'cyan', 'magent +a', 'black' ], [ 'red', 'orange', 'yellow', 'cyan', 'magent +a', 'black' ] ] ); my @tree2 = Combine_Branches (\@tree1, 1, 3); my $done_string = Dumper(@done); my $tree2_string = Dumper(@tree2); print "Combine_Branches(\@tree1, 0, 3);\n"; if ( $done_string ne $tree2_string ) { print "Ack, not the same.\n"; print "$tree2_string\n"; print "$done_string\n"; } else { print "Everything is joy.\n" }


Comment on Re: Combining Branches in Trees
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://351017]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (14)
As of 2015-07-06 18:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (80 votes), past polls