I am currently working on a script which involves some RSA encryption, as well as MD5 work.

Here is the troublesome subroutine:
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; }
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?

What does this little button do . .<Click>; "USER HAS SIGNED OFF FOR THE DAY"

In reply to Strange problems with Tie by tame1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.