Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: I need help with some recursion

by ragnarokPP (Initiate)
on Dec 08, 2012 at 11:51 UTC ( #1007890=note: print w/replies, xml ) Need Help??


in reply to Re: I need help with some recursion
in thread I need help with some recursion

It is perfect, simple. But if i applied it for all the lines the result will be:

1,2,4,3,6,7 2,3,4,7,6,1 3,7,1,2,4,6 4,6 5,10,11,12,13 6 7,1,2,4,3,6

but i am looking for something like this:

1,2,4,3,6,7 5,10,11,12,13

Replies are listed 'Best First'.
Re^3: I need help with some recursion
by tobyink (Abbot) on Dec 08, 2012 at 14:23 UTC

    So don't apply it to all the lines. This seems to produce something close to your desired output:

    my %seen; for (my $i = 1; $i < @lines; $i++) { next if $seen{$i}; my @results = line_closure($i); print Dumper \@results; $seen{$_}++ for @results; }
    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

      it seems work perfect. thank you very much.

      thank you very much

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007890]
help
Chatterbox?
[marto]: more so than the previous show I saw
[Corion]: marto: Well, I think they go a tour every two years and I think it's hard to even get a connection with the crowd at a 20k people concert... But maybe after this time I'll stop too ;)
[Corion]: I still have to see the Pet Shop Boys live before they stop touring at all
[marto]: yeah, I think that as a group creatively they're done. I can understand how it'd be hard to stop the process, album/tour, album/tour, if that's pretty much all you've ever done :)
[marto]: Corion yes I saw them Pandemonium_Tour
[Corion]: marto: Yeah, and I doubt that they'll ever get back to something like Violator/Songs of Faith and Devotion - it would either alienate their "regular" crowd, or be "too much Violator" ;)
LanX needs to see Freddy Mercury'
[Corion]: marto: Yeah, I have that on DVD even, and I missed them last year because I was in London at the time ironically ;)
[marto]: put me in the mood to listen to this now :)
[Corion]: LanX: Well, grab a shovel :)

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (10)
As of 2017-03-24 11:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (301 votes). Check out past polls.