ok..still not working..maybe if i do it this way..

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);
} 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>


Is there some "stupid newbie" mistake on here?
Michelle Rogers
----- Original Message ----- 
From: "Randy W. Sims" <[EMAIL PROTECTED]>
To: "Michelle Rogers" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, June 19, 2004 12:06 PM
Subject: Re: hashes and writing to file..


> On 6/19/2004 11:51 AM, Michelle Rogers wrote:
> > Hello...
> > I have just started using Perl because I wanted to use it for CGI..
> > I had been using Euphoria for stand-alone
(http://www.rapideuphoria.com).
> > I am trying to create a tutorial type web site, where students log in
and receive instruction, based on what they need help with.  It seems I am
stuck at the simplest part, so far..heh..
> > But, I have created a hash of hashes, which I was able to do by looking
at um..i think it is perldocs.com.
> > Anyway, I am now trying to save that hash of hashes to a file...the book
i have (Teach yourself Perl in 24 hours) seems to imply that it is as easy
as using
> >
> > print FILEHANDLE @studentlist;
> >
> >
> > However, this isn't working..it is saving SOMETHING..but when I try to
read back in (by using   @studentlist=<FILEHANDLE>;)
> > I am getting something like
> >
> >  student1HASH(0x155efb4): { }
> >
> >
> > for the data that is read in.
> >
> > Can someone give me a quick example of how to read/write hashes to a
file?
>
> There are several options.
>
> 1. Perl comes with a module, Storable, that can be used to read/write
> entire data structures easily:
>
>    use Storable;
>    store \%data, 'file';
>    $hashref = retrieve('file');
>
> 2. If you have a larger data set and you only need to look at a subset
> of that data per run, you can use the MLDBM module:
>
>   use MLDBM;
>   $dbm = tie %data, 'file';
>
> Further up the list would be using a full blown database with the DBI::*
> modules, but the above is probably sufficient.
>
> Regards,
> Randy.
>


-- 
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