Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Recursive loops

by reaper9187 (Scribe)
on Dec 11, 2012 at 11:44 UTC ( #1008281=note: print w/replies, xml ) Need Help??

in reply to Recursive loops

The actual subroutines are very long and perform comprehensive checks.... I can , however, give you some sample data


I have an array @array = (A,B,C,D,E,F) (these values are again picked up from another subroutine .so i have no control over its size.) For the elements in the array I perform a check (using sub A) and assign values(using sub B , say A=1, B=2 , C=4 etc) .. I then use these updated values to perform a specific check(using subA). Assume that i need to change the value for A,B again (using B). This is done iteratively done till i observe no clash

So the input is something like @array = (A,B,C,D,E..) Process;
1. Perform using sub A
2. Assign values using B
O/p after first iteration : A= 1, B = 2 , C = 2, D= 4, E= 5;
3.Check again using A
-Assuming I need to change the values for C, D.
4.Assign values using B
5.Check again using A. If no faults detected, break out of loop

The final o/p would look like A= 1, B= 2,C = 3,D =4,....
Note that the above is jus an example of the process flow and not the actual data.

Replies are listed 'Best First'.
Re^2: Recursive loops
by dsheroh (Prior) on Dec 12, 2012 at 10:13 UTC
    In that case, you don't even need a queue. To restate your description of the process:
    While subA detects faults, use subB to correct them.
    Translating this to Perl is trivial:
    while (subA(@array)) { subB(@array); }
    while (my @faults = subA(@array)) { subB(\@array, \@faults); }
    if subB needs to know what the list of faults was.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1008281]
[AnomalousMonk]: choroba: It even has Rama's (relatively) high rate of spin, although I don't know if it's axial spin.
[LanX]: Rama spins?
LanX probably in my stomach
erix considers showing this to choroba , thinks better of it

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (10)
As of 2017-11-22 16:59 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (327 votes). Check out past polls.