in reply to Database hash/array mapping and OO

The variable %columns is only available in User::new(). Also, it's misspelled in User::get_user(), but even spelling it correctly won't work ;-).

An approach would be to not bless the returned array reference, but bless a hash reference which holds both the array reference with the records, and the column names:

... my $self = {}; $self->{records} = $sth->fetchall_arrayref(); $self->{columns} = \%columns; ...
Now, in User::get_user(), you get:
... return $self->{records}->[$row][{$self}->{columns}->{$field}]; ...
Note, the code is untested, so there could be a syntax error lurking in there somewhere, but I hope I got the point across.

Arjen