from defined
Returns a Boolean value telling whether EXPR has a value other than the undefined value undef. If EXPR is not present, $_ will be checked.

you are getting a true boolean value 1, which means when the option is present, you are just storing the return value of defined($options{o})

try ? :

my $source_file = defined($options{o}) ? "<some filename>" : "as.xcf-d +ist" ;


Vivek
-- 'I' am not the body, 'I' am the 'soul', which has no beginning or no end, no attachment or no aversion, nothing to attain or lose.

In reply to Re: checking $option by targetsmart
in thread question about getopt by Sun751

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":