#!/usr/bin/perl -w # file somescript.pl use strict; use warnings; sub SubThatNeedsToBeTested { # do some stuff if ($error ) { print "error occurred\n"; exit 2; } if ($othererror) { print "another error occurred\n"; exit 3; } } sub NoNeedToTestThis { # ... } ## main program &SubThatNeedsToBeTested (); &NoNeedToTestThis (); exit 0;