Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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.

Replies are listed 'Best First'.
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?
[LanX]: ;)
[Discipulus]: good night monks!
[shmem]: LanX: oh... now I have to figure out if this is good or bad news.
LanX bad day monks ?
[LanX]: hope you find sleep
[shmem]: LanX: which one?
[LanX]: the last
Discipulus yes a very bad day
[shmem]: grandola, vila morena
[shmem]: LanX: ah, that one. You'll get the bug reports also :P

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2017-04-29 22:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (534 votes). Check out past polls.