tame1 has asked for the wisdom of the Perl Monks concerning the following question:
Everything seems fine (It all prints out - %hash only contains 2 keys and 2 values) until the final print of the Public Key - THAT comes up blank. $server is set fine, but $val is empty. The sub also returns nada. Can anyone see what I am doing wrong to cause this?sub get_pubkey { my $issuer = shift; my %hash; tie %hash, 'BerkeleyDB::Hash', -Filename => "/home/httpd/newkeyrin +g" or die "Cannot tie the hash to that file: $! $BerkeleyDB::Error\n" +; open(TEST, ">> fields_data"); foreach my $hashkey (keys %hash) { print TEST "The pubkey is: $hashkey\n"; print TEST "The value is: $hash{$hashkey}\n"; print "The pubkey is: $hashkey<br>\n"; print "The value is: $hash{$hashkey}<br>\n"; } my $server = "$issuer" . ".PUBLIC"; my $val = $hash{$server}; close(TEST); untie %hash; print "Server is : $server<br>\n"; print "Public key currently is: $val<br>\n"; return $val; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Strange problems with Tie
by clintp (Curate) on Mar 26, 2001 at 21:43 UTC | |
|
(Ovid) Re: Strange problems with Tie
by Ovid (Cardinal) on Mar 26, 2001 at 21:39 UTC | |
|
Re: Strange problems with Tie
by tame1 (Pilgrim) on Mar 26, 2001 at 22:04 UTC |