#!/usr/bin/perl # Roberto Silveira - Review for 3 cousines # ------------------------------------------------------------ print "Content-type: text/html\n\n"; print "\n"; # Get the input #read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Get the input for GET method $buffer = $ENV{'QUERY_STRING'}; # Split the name-value pairs @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; # Uncomment for debugging purposes #print "Setting $name to $value

"; $FORM{$name} = $value; } if($FORM{'cuisine'} eq 'Italian'){ print "Mama Gina Resturant: Good Pizza - Bad Pasta\n"; } elsif ($FORM{'cuisine'} eq 'Indian'){ print "Indian Restaurant: Good curry - Bad beef \n"; } elsif ($FORM{'cuisine'} eq 'American'){ print "American Restaurant: Good hamburger - Bad coffee \n"; } print "\n";