my $btn = $q->param('button'); if( $btn eq 'viewBtn' ){ ... }elsif( $btn eq 'editBtn' ){ ... }else{ ... }