http://www.perlmonks.org?node_id=1000717


in reply to Perl/TK: how to set defaults for the whole script?

... keep it in a variable ...

Not being quite as adventurous as choroba or kcott, I will often use a constant for something like this. The other alternative is a Readonly hash, but  Readonly imposes execution overhead that may be undesirable. The functional approach of stefbv is also nice.

use constant SCALE_DEFAULTS => qw(-width 10 -length 200 -etc 42); my $s = $MW->Scale(SCALE_DEFAULTS, -override => 1, etc...);