#!/usr/bin/perl -w use CGI ':standard'; print header, start_html('Order Ice Cream with Price'), h1('Order Ice Cream with Price'); generate_form(); print_results() if param(); print end_html(); sub print_results { my @top = param('toppings'); print b('Customer name: '), param('customer'), br, "You ordered ", param('no_unit'), ' unit of ', param('cone'), ' cone.'; print br; # how to include the perl script "compute_price.pl" result here? print ('Total price is ...'); } sub generate_form { print hr, start_form, strong('Your name : '), textfield( -name => 'customer' ), br,br strong('Cone: '), radio_group( -name => 'cone', -multiple => 1, -values => [qw/sugar waffle/]),br,br strong('Number of Units: '), textfield( -name => 'no_unit'), br,br submit( -value => 'Send Order' ), end_form, hr; } #### $ perl compute_price.pl -type sugar -unit 3 #### #!/usr/bin/perl -w use strict; use Data::Dumper; use Carp; use Getopt::Long; my $cone_type = 'sugar'; my $no_unit = 1; my $help = 0; if ( @ARGV == 0 ) { &usage(); exit(1); } my $res = GetOptions ( "type=s"=>\$cone_type, "unit=i"=>\$no_unit, "help"=>\$help,); if ($res) { die "Unit too large\n" if ($no_unit > 5); my %unitprice = ( 'sugar' => 100, 'waffle' => 200 ); my $total_price = $unitprice{$cone_type} * $no_unit; print "$total_price\n"; } sub usage { print <