Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Problem printing return value from a subroutine

by chromatic (Archbishop)
on Oct 04, 2012 at 03:58 UTC ( #997173=note: print w/ replies, xml ) Need Help??


in reply to Problem printing return value from a subroutine

induced() returns a list flattened from an array. my $qw=induced(@{ $subgraphs[$d-1] }); evaluates that return value in scalar context. If you want to return a scalar, you should join the elements of the array. If you want to return a list, you need to capture it as an array or something which provides list context.


Improve your skills with Modern Perl: the free book.


Comment on Re: Problem printing return value from a subroutine
Select or Download Code
Re^2: Problem printing return value from a subroutine
by zing (Beadle) on Oct 04, 2012 at 08:10 UTC
    But the problem chromatic is this :-
    component 2 = e d induced=3 component 1 = c b a b c a induced=3
    For component 2 (e d),, there shouldn't be any return value,as there is no line in data which has these vertices. Whereas for component 1(c b a), the first line of data file (b c a) should be returned.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (17)
As of 2014-07-29 17:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (225 votes), past polls