in reply to Passing a hash byreference to a subroutine
You are not passing it by reference: you are just passing the hash.
What happens is that @_ in the sub flatten out the hash so each keys and values go into the @_ array and you assign it to a scalar $existing_users
You pass by reference.. passing a reference: process_users(\%results) or process_users($results_reference) and inside the sub you just grab the first argument arrived in (the flattener) @_ and you know it is a reference, so:
sub process_users( my $result_ref = shift; # dereference it if needed foreach my $key ( %$result_ref ){ ... )
L*
|
|---|