[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] Errors in Two-Dimensional Arrays



my @conn;
...is for tracking essential user information.

Understanding that $usernick is properly set to their screenname, I'm
trying to get a 2 dimensional array through @conn and $usernick w/ no
strict "refs";

So far, I've tried the following setups:
$conn[$usernick][0] = $conn_id;
$conn[$usernick]->[0] = $conn_id;
$conn[$usernick[0]] = $conn_id; # this one didn't even run..but, I
still tried it.
$conn[$$usernick][0] = $conn_id;
$conn[$$usernick]->[0] = $conn_id;

Now...this variable, along with $conn[$usernick][1] and
$conn[$usernick][2] are set when someone properly logs into an
account.
if (!$conn[$usernick][0]) {
  # login process
} else {
  # send "already logged in" error message to user
}
For some reason, this test fails for any users after the 1st has
logged in and, no matter who it is, $conn[$usernick][0] equals the
$conn_id of the first user...

Example:

# user1 and user2 log in:
# inserting values of $usernick ...

if ($conn["user1"][0]) {
  # login process
} # passes

if ($conn["user2"][0]) {
  # login process
} # fails; and they recieve the "already logged in" error.

My only guess is that it's reading it as $conn[0] for both and
ignoring the [$usernick] bracket.