You should investigate Tie::File bro'!
Here (stripped of all the HTML stuff) is an example of what you can do. To store your password entries you would do something like this:
and to read the entries you could do the following:#!/usr/bin/perl -w use Tie::File; use strict; my @pwfile; tie @pwfile, 'Tie::File', 'pwfile.dat' or die $!; my $user = { name => 'Klem Kaddiddlehopper', uid => 'kkhopper', addr => '123 main street, anywhere, anystate, 12345, USA', passwd => 'shhh!' }; my @fields=qw / name uid addr passwd /; # # Add the record! push @pwfile,join('|',map{ $user->{$_}} @fields );
#!/usr/bin/perl -w use Tie::File; use strict; my @pwfile; tie @pwfile, 'Tie::File', 'pwfile.dat' or die $!; # # Find a record my $uid='kkhopper'; my $found=0; foreach my $entry (@pwfile) { my @entries=split(/[\|]/,$entry); $found = 1 if ( $uid eq $entries[1]) and ($entries[3] eq 'shhh!' ); } printf "WHHHOOOPPIE!\n" if $found;
I over simplified this for clarity sake.
I leave implementing this as part of your CGI up to your imagination.
| Peter L. Berghold -- Unix Professional Peter at Berghold dot Net | |
| Dog trainer, dog agility exhibitor, brewer of fine Belgian style ales. Happiness is a warm, tired, contented dog curled up at your side and a good Belgian ale in your chalice. | |
In reply to Re: Perl to wite and search text file
by blue_cowdawg
in thread Perl to wite and search text file
by Ragna
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |