#!/usr/bin/perl use Getopt::Long; GetOptions("tk" => \$tk); if ($tk) { &tk(); } do this do whatever.... blah more blah sub tk { use Tk; use strict; more blah blah and yet more blah }