Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007890]
[1nickt]: Ya gotta love the google. If you set accept=".txt" in a form input field where type="file", Chrome will allow you to select local files with extensions like .pl, .pm, .yaml, .ini etc. Nice!

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2017-07-22 18:24 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (340 votes). Check out past polls.