Hola monqueros,
When I run this code I get a single key and value for the %passfile (followed by the value of $check_me). This is in keeping with my suspicion that I am not getting everything into %passfile that I thought I was. Though when I printed the keys and values using
while (my ($k, $v) = each %passfile) { I got all everthing I could see in the file.
I am using Data::Dumper for the first time and I am unsure whether my error is in the way I create my hash or in the way I try to Dump it. Here is the sub which creates the hash:
sub read_passfile {
%passfile = ();
open (PF, "$pass_file") or die "Couldn't read password file: $!";
while (<PF>) {
chomp;
@_ = split("\t", $_);
$passfile{ $_[0] } = $_[1];
close PF;
}
}
And here is the Data::Dumper code.
my $check_me = my $check_me = $form_data{ 'new_user_name' };
my $h = \%passfile;
my @c = [$h, $check_me];
my $d = Data::Dumper->new(@c, \@c);
print $q->header;
print $d->Dump;
exit;
Any advice appreciated.
TIA
jg
_____________________________________________________It's not my tree.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.