#do the output if($is_script eq 'yes'){ middle(); bottom(); } else { top(); middle(); bottom(); } #### top() unless $is_script eq 'yes'; middle(); bottom();