Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^4: Problem printing return value from a subroutine

by zing (Beadle)
on Oct 04, 2012 at 15:40 UTC ( #997251=note: print w/replies, xml ) Need Help??

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
sub 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; }
But the output is still far from wanted
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.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2016-10-21 22:46 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (291 votes). Check out past polls.