in reply to Possible looping or syntax error
First of all, your code doesn't compile. Secondly, your indentation is pretty poor. Here's what I think the code should look like: (Not compiled -- just reformatted using perltidy)
if (param()) { my $name = param('name'); my $update = param('search'); if ($search eq "Exact") { if ($name) { if (exists $snailmail{$name}) # Missed closing ) { print "$snailmail{$name}"; } else { print " Name not found in directory "); } # Missed open and closing braces } else { print " Please enter a name to search for "; # Nothing here allows a user to enter a name. } # Missed open and closing bracesA } elsif ($search eq " All ") { foreach (sort keys %snailmail) { print "$_ : $snailmail{$_} "; } } # Missed closing brace } # Missed closing brace
Finally, I'd suggest you do some work running this code through the debugger, trying different values and seeing where it takes you. If you're still stuck after all that, come on back and post again.
|
|---|