in reply to Global variable vs passing variable from sub to sub
I don't understand the last line of:
And I don't understand the point of:sub account_over_limit { my ($account, $balance) = @_; return exists $LIMITED_ACCOUNTS{$account} && $balance > $LIMIT; }
BEGIN { my $var; sub set_var { $var = shift; } sub var { $var; } }
I've had numerous problems trying to determine where a global was changed, and I have a feeling there's a good anti-global argument around here somewhere, but I can't find it. When a script is doing alot of calculating and outputting just the end result, I don't think it matters how localized things are. You still won't know what affected the output.
Another, barely related thing--I'm just about done with a GNU tar GUI for Windows, and I'm finding good uses for goto all over the place.
Anyway, please make your code examples as simple as possible and explain them properly.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Global variable vs passing variable from sub to sub
by BUU (Prior) on Sep 14, 2004 at 10:10 UTC | |
by kiat (Vicar) on Sep 14, 2004 at 11:16 UTC | |
| |
|
Re^2: Global variable vs passing variable from sub to sub
by Anonymous Monk on Sep 14, 2004 at 19:41 UTC |