On Tue, Jan 15, 2002 at 03:25:54PM -0600, Tomasi, Chuck wrote:
> @UserCache; # Place to store data already seen
> sub GetUser
> {
> my ($id, $user)=@_; # record number and hash reference to populate
^^^^^^^^^^^^^^^
>
> if (defined($UserCache[$id])) {
>
> $user = $UserCache[$id];
> return(1);
$user is lexically scoped to the body of the subroutine; this assignment
right before a return is pointless.
I guess you also have a global variable named $user, which is what you
meant to set. Global variables should generally be avoided; have GetUser()
return the value instead.
BTW, I don't see where the hashes come in. @UserCache is an array.
Ronald