#!/usr/bin/perl -- use strict; use warnings; Main( @ARGV ); sub Main { my $q = CGI->new({ @_ }); my $action = $q->param('go'); if( !defined $action or !length $action ){ return ShowEmployees( $q ); } elsif( $action eq 'confirmDelete' ){ return ConfirmDeleteEmployees( $q ); } elsif( $action eq 'delete' ){ return DeleteEmployees( $q ); } else { return UnrecognizedAction( $q ); } #### #!/usr/bin/perl -- use strict; use warnings; use CGI; Main( @ARGV ); sub Main { my $q = CGI->new({ @_ }); my $action = $q->param('go'); if( !defined $action or !length $action ){ return ShowEmployees( $q ); } elsif( $action eq 'update' ){ return UpdateEmployee( $q ); } elsif( $action eq 'delete' ){ return DeleteEmployees( $q ); } else { return UnrecognizedAction( $q ); } } sub UpdateEmployee { my( $q ) = @_; my $name = $q->param('name'); my $id = $q->param('id'); print "name($name) id($id)\n"; } __END__ $ perl ogg.pl Undefined subroutine &main::ShowEmployees called at ogg.pl line 9. $ perl ogg.pl go fish Undefined subroutine &main::UnrecognizedAction called at ogg.pl line 15. $ perl ogg.pl go update Use of uninitialized value $name in concatenation (.) or string at ogg.pl line 22. Use of uninitialized value $id in concatenation (.) or string at ogg.pl line 22. name() id() $ perl ogg.pl go update name bob Use of uninitialized value $id in concatenation (.) or string at ogg.pl line 22. name(bob) id() $ perl ogg.pl go update name bob id 77 name(bob) id(77)