Hello List, i just got stuck with hashes, hashes of hashes and referenzes... I know i have to study a bit about all of that... :-( So i hope theres somebody who can tell me the way (or direction...) :-)
I have a mysql Table and want the values out of the table in a hash of a hash: I have a timestamp in the table for each dataset and i want to be able to access each part of the dataset, ordered by timestamp and column name. Thats my Script: #!/usr/bin/perl -w # Johannes Theuerkorn for use with Teres, SieMo etc # 06-2002 Bruchsal # # strict for not making failures :-) use strict; # use DBI mod use DBI; my $db = "DiREx"; my $user = "username"; my $pwd = "password"; my $debug =0; # Datenbank-Verbindung aufbauen #my $dbh = DBI->connect( 'dbi:mysql:'.$db,$user,$pwd) || my $dbh = DBI->connect( 'dbi:mysql:'.$db,$user,$pwd) || die "Canīt connect to MySQL-Server: $DBI::errstr\n"; my %test_timestamp; my %values; my $sth=$dbh->prepare ("select tstamp,serial,retests,passfail from nt5340.board where serial='CN+/P8100672'"); $sth->execute; while (my ($tstamp,$serial,$retests,$passfail)=$sth-> fetchrow_array){ %values=(); %values=(tstamp=>$tstamp,serial=>$serial,retests=>$retests,passfail=>$passfail); print "$values{tstamp} $values{serial} $values{retests} $values{passfail}\n"; $test_timestamp{$tstamp}=\%values; print "$test_timestamp{$tstamp}{tstamp}\n"; } foreach my $keys (keys %test_timestamp){ print "$keys\n"; print "$test_timestamp{$keys}{tstamp}\n"; print "$test_timestamp{$keys}{serial}\n"; print "$test_timestamp{$keys}{retests}\n"; print "$test_timestamp{$keys}{passfail}\n"; } $sth->finish; $dbh->disconnect; This works so far, in the while fetchrow_array Loop it prints the values it should, but later in the foreach loop it only prints the last entry from the Database. Wheres that error from and how can I get rid of it? Greets Johannes -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]