sulfericacid
Programmer
I was told you can't do prints with a for loop which would explain why I am getting an error on the line I am trying to print the keys of my database. Can anyone help me get these keys to print?
#!/usr/bin/perl -w
use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser);
require SDBM_File;
use POSIX;
use CGI qw/:standard/;
my $query = CGI->new;
my %form = $query->Vars;
my $dbm = "poems.dbm";
tie( my %dbm, 'SDBM_File', $dbm, O_CREAT | O_RDWR, 0644 )
|| die "Died tying database\nReason: $!\n";
if ( $form{'poemtitle'} && $form{'poemsub'} ) {
$dbm{ $form{'poemtitle'} } = $form{'poemsub'};
print header(), start_html('Success'),
"Your poem entitled <b>$form{'poemtitle'}</b> has been added\n",
end_html();
}
else {
print header(), start_html('Poetry Submissions'),
#########
for ( sort keys %poemtitle ) {
print $_;
}
start_form, "Submission Title", textfield('poemtitle'), p, "Submission",
textarea(
-name => 'poemsub',
-rows => 10,
-columns => 50
),
submit, end_form, hr, end_html();
}
"Age is nothing more than an inaccurate number bestowed upon each of us at birth as just another means for others to judge and classify us- sulfericacid
#!/usr/bin/perl -w
use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser);
require SDBM_File;
use POSIX;
use CGI qw/:standard/;
my $query = CGI->new;
my %form = $query->Vars;
my $dbm = "poems.dbm";
tie( my %dbm, 'SDBM_File', $dbm, O_CREAT | O_RDWR, 0644 )
|| die "Died tying database\nReason: $!\n";
if ( $form{'poemtitle'} && $form{'poemsub'} ) {
$dbm{ $form{'poemtitle'} } = $form{'poemsub'};
print header(), start_html('Success'),
"Your poem entitled <b>$form{'poemtitle'}</b> has been added\n",
end_html();
}
else {
print header(), start_html('Poetry Submissions'),
#########
for ( sort keys %poemtitle ) {
print $_;
}
start_form, "Submission Title", textfield('poemtitle'), p, "Submission",
textarea(
-name => 'poemsub',
-rows => 10,
-columns => 50
),
submit, end_form, hr, end_html();
}
"Age is nothing more than an inaccurate number bestowed upon each of us at birth as just another means for others to judge and classify us- sulfericacid