Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Problem with hash

by ozone (Friar)
on Apr 19, 2004 at 08:58 UTC ( #346230=note: print w/replies, xml ) Need Help??

in reply to Problem with hash

one way is to use a recursive sub, that 'walks' up the userid tree until it reaches a node without a manager (or a special id (like 0 or undef)

the other way is do the same as above, but use a stack and a loop

some pseudo code

# simple recursive sub sub create_users { my $user_href = shift; my $userId = shift; if(defined $user_href->{$userId} and $user_href->{$userId} != 0) { create_users($user_href, $userId); } else { return; } # now write the user to the db write_user_to_db($user_href, $userId }

I think the above should work :-)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://346230]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2022-05-22 14:52 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (80 votes). Check out past polls.