in reply to Prioritizing command line options

You don't show what's in file, but why not just use another option variable? (Note, this is untested.)

my %help_options = ( "color!" => sub { $options{USE_COLOR_CMDLINE} = $_[1] }, "conf=s" => sub { $options{CONF} = $_[1] }, ); GetOptions( %help_options ); do $options{CONF} if defined $options{CONF}; # Override it if specified on the command line. $options{USE_COLOR} = $options{USE_COLOR_CMDLINE} if exists $options{USE_COLOR_CMDLINE};
That's not necessarily the easiest or best way to accomplish it, but it's probably the smallest change to your example code that would do it.

On a separate note, I cringe at the idea that your program variables are spread among its own and the external file. (In other words, the external file knows the name of the %options hash and the particular key values, so if you change one you have to change the other.) I'd much rather use a "ini" style file with var = value pairs or some such, where I can map the keys to my variables through a hash or something. Of course, I don't know what limitations you're working under, so maybe this isn't practical for you, but if it is, I'd really recommend the change.