in reply to Re^3: Problem printing return value from a subroutine
in thread Problem printing return value from a subroutine
Hi AM,
I changed the code as per your suggestion
But the output is still far from wantedsub induced { my (@z) = @_; my $triplet = $trip[0]; my %Pie; undef @Pie{ @z }; delete @Pie{ @$triplet }; print "@$triplet\n" if keys(%Pie) <= (@z - @$triplet); return @$triplet; }
component 2 = e d $VAR1 = 'b'; $VAR2 = 'c'; $VAR3 = 'a'; component 1 = c a b b c a $VAR1 = 'b'; $VAR2 = 'c'; $VAR3 = 'a';
Let me explain you what is wanted.Consider for example component 2. It has two vertices e,d. Now I want to see if any of the rows from "DATA" is a subset of these points.Now since each of the row of "DATA" has 3 vertices/points,therefore clearly for component two there isnt any induced line from DATA.Therefore there should be anything to print for the subroutine "induced" for this case.
But for component 1,which has vertices as = c,a,b; the first line of "DATA" which is "b c a" gets induced.
Similarly if component=a,b,c,d ; then first two rows of DATA get induced ,as they are both the subset of the component.
In Section
Seekers of Perl Wisdom