http://qs1969.pair.com?node_id=11139474


in reply to multiple keys hash with array as a value - loop

grandagent,
You said "but it only give me the first user in the hash" when what you should have said is "it only produces output for user rmdb_dbo". That's because your if condition is only displaying output for that user. Try this to debug:
for my $connection (keys %h) { print "Looking at connection '$connection'\n"; for my $userid (keys %{$h{$connection}}) { print "\tLooking at userid '$userid'\n"; @a_ref = @{$h{$connection}{$userid}}; if(lc($userid) eq "rmdb_dbo") { print @a_ref, if ( $a_ref[1] =~ m/update\s*[table\s*]rmdb_ +dbo./i ); } else { print "Not checking '@a_ref' because user is not 'rmdb_dbo +'\n"; } } }

Cheers - L~R

Replies are listed 'Best First'.
Re^2: multiple keys hash with array as a value - loop
by grandagent (Novice) on Dec 08, 2021 at 20:13 UTC
    My description was a bit confusing I admit. I just used "value1" "value2" as a placeholder. The acutall strings look like this:
    value1 = UID="rmdb_dbo";DBN=234952;... value2 = update rmdb_dbo....

    where value2 can be also "insert/delete ..." and so on (any type of SQL statement)

    rmdb_dbo is the user that can have multiple connections i.e. multiple connection-id's for that particular user

    Cheers