in reply to Re^4: GetOpt Organization (only)
in thread GetOpt Organization

Thank you very much tye for your explanation.

I try to think this one step ahead.

Consider this simple example:

my %hash; foo(\%hash); bar(\%hash); sub foo{ my $ref = shift; } sub bar { my $ref = shift; } # perhaps many more

So a cleverle might come and say: "Passing around these refs and dereferencing them all the time is a pain" - i make it so instead:

our %hash; foo(); bar(); sub foo{ our %hash; } sub bar { our %hash; }

IMHO this idea is, with all due respect, debatable. Or it is against the pure doctrine, as you like.

My best regards, Karl

P.S.: Daddy says globals are the root of all evil ;-)

«The Crux of the Biscuit is the Apostrophe»

Replies are listed 'Best First'.
Re^6: GetOpt Organization (only)
by Anonymous Monk on Mar 10, 2015 at 23:44 UTC
    For a lot of programs not using %opt makes sense, but for a lot of programs using %opt makes sense ...

    if all the options do is set values that get passed to a template after validation, having it as $prefix instead of $opt{prefix} ...

    if things are going to end up in a hash anyway, might as well start out in a hash :)