> Dave, I've got some more code here that should explain exactly what I'm > trying to do, what do you think of the structure? As you can probably tell > I'm having problems accessing the keys and values from a tied hash, any > ideas how I can get the keys and the values printed to the screen? > > Code: > > ############################################################# > > sub get_users_table_and_columns{ > my $self=shift; > > use Tie::IxHash; > $self->{tables_and_columns}= Tie::IxHash->new(table=>'blog', > column1 =>'first_name', > column2 => 'last_name', > column3 => 'email', > column4 => 'password', > column5 => 'active' > ); > > return $self->{tables_and_columns}; > > } > > ######## in the cgi call the above method and pass it to the "add_user" > method ######### > > $register->add_user($conf->get_users_table_and_columns, $first_name, > $last_name, $email, $password); > > ############################################################# > > sub add_user{ > my $self=shift; > my $tables_and_columns=shift; > my $first_name=shift; > my $last_name=shift; > my $email=shift; > my $password=shift; > my $key=''; > my $value=''; > > foreach my $value(@$tables_and_columns){ > print "value = $value\n"; > > } > > } > ############################################################# >
This sounds highly overcomplicated... must you use Tie::IxHash? Could you possibly use something else? If you *must* use Tie::IxHash, you can do something like: use Data::Dumper; use Tie::IxHash; my $h = Tie::IxHash->new( table => 'blog', column1 => 'first_name', column2 => 'last_name', column3 => 'email', column4 => 'password', column5 => 'active', ); # this shows you the internal structure print Dumper($h); # this seems broken... print "$_\n" for keys %$h; print '-'x20, "\n"; # this should do what you want # breaks encapsulation tho print "$_\n" for @{$h->[1]}; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>