On Fri, 29 Jun 2001, Kim Green wrote:

> What's the proper syntax to indicate that a variable is optional? The script
> that I have created works great when I pass in a variable, but the script
> need to execute the SQL even if I don't pass in a variable.

You can set a sane default for the variable:

my $option = $ARGV[0] || 1;

If $ARGV[0] is not defined, then $option will be 1.

Or you create your program logic accordingly to do one thing if the option
is defined and another thing is if isn't defined.

-- Brett
                                   http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
I B M
U B M
We all B M
For I B M!!!!
                -- H.A.R.L.I.E.

Reply via email to