well...on another screen..i'm trying to print it back out to make sure it IS working... i'm using this code to do that.
<snip> print "<h1><center><b>CURRENT STUDENTS</b></center></h1><P><P><hr>"; use Storable(); $studentlist = retrieve('c://studentdata//studentdata.db'); foreach $fieldname ( keys %student ) { print "$fieldname: { "; for $thedata ( keys %{ $studentlist{$fieldname} } ) { print "$thedata=$studentlist{$fieldname}{$thedata} "; } print "}<P><P>"; } </snip> it seems to be just brining in blank data... if you want to see it in action, you can look at http://icanread.no-ip.org login to administration....then use "michelle" and "phonics" for the username and password... if you add a student, it says it worked (of course, since that's only a print statement, anyway).. but then if you go back to "list students" ..it doesn't list any Michelle Rogers ----- Original Message ----- From: "Randy W. Sims" <[EMAIL PROTECTED]> To: "Michelle Rogers" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Saturday, June 19, 2004 12:57 PM Subject: Re: hashes and writing to file.. > On 6/19/2004 12:37 PM, Michelle Rogers wrote: > > > ok..still not working..maybe if i do it this way.. > > What exactly is not working? Are you getting an error? > > > here's the code i have for storing.. > > <snip> > > > > #!/usr/bin/perl -w > > use CGI qw(:standard); > > use Storable; > > print "Content-type:text/html\n\n"; > > > > $sname=param('sname'); > > $spassword=param('spassword'); > > > > > > if (open(MYFILE,"c://studentdata//studentdata.db")) { > > #I haven't inserted the read part here, yet.# > > close(MYFILE); > > You don't need to open the file with open; use the 'retrieve' method. > > > } else { > > > > %student = ( > > student1=>{ > > username => $sname, > > password => $spassword, > > }, > > ); > > > > store \%studentlist, 'c://studentdata//studentdata.db'; > > > > print "<h1><center>Student was added!</h1><P><P>"; > > print "<form action='adminlogin.cgi' method='post'>"; > > print "<input type='hidden' name='name' value='michelle'>"; > > print "<input type='hidden' name='password' value='phonics'>"; > > print "<input type='submit' value='Continue'>"; > > } > > </snip> > > Here is a working example: > > #!/usr/bin/perl > > use warnings; > use strict; > > use Storable; > > my %data = ( > student1 => { > username => 'name', > password => 'pass', > }, > ); > > store( \%data, 'data.db' ); > > %data = (); > > my $data_ref = retrieve( 'data.db' ); > > use Data::Dumper; > print Dumper( $data_ref ); > > __END__ > > Randy. > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>