#!/usr/bin/perl -w use strict; decide ('add'); decide ('edit'); decide ('bad input nothing'); print "\n"; decide2 ('add'); decide2 ('edit'); decide2 ('bad input nothing'); sub decide { my $input = shift; print "invalid input\n" if ($input ne "add" and $input ne "edit"); print "doing an add\n" if $input eq "add"; print "doing an edit\n" if $input eq "edit"; } sub decide2 { my $input = shift; if ($input eq 'add') { print "the add code goes here\n"; } elsif ($input eq 'edit') { print "the edit code goes here\n"; } else { print "the invalid input code goes here\n"; } } __END__ doing an add doing an edit invalid input the add code goes here the edit code goes here the invalid input code goes here