in reply to Re^7: Advise on sql table mapping.
in thread Advise on sql table mapping.

I struggled with the concept of recursion for a long time until I grasped it, myself. The idea is that, to get from A to B, you go one step from A (say, to A1) and then just need to find the way from A1 to B. Now, to get from A1 to B, you take one step from A1 (say, to A2) and then just need to find the way from A2 to B ...

The for loop just filters out all the places we've been before for this path. It can be written as follows:

my @possible_next_steps = @{$links{$start}}; my @unvisited_nodes = grep { ! $visited->{$_} } @possible_next_steps; # Now, for each unvisited node, see if we can reach the goal from ther +e for (@unvisited_nodes) { ... };