OK!!  I think I got it!!!!!!!!!!!!

*dances around happily, doing the "Snoopy happy-feet dance"!!*
Thank you!
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>


Reply via email to