in reply to Re^2: Avoiding Globals with OO Perl
in thread Avoiding Globals with OO Perl

work($a,$b,$c,$d,$e,$f); sub work{ my ($a,$b,$c,$d,$e,$f) = @_; more_work($b,$c); print "$a\n"; } more_work{ my ($b,$c) = @_; even_more_work($c); print "$b\n"; }

$d, $e, $f are never used, and $b & $c are only used by more_work().

Then perhaps what you should be doing is:

more_work( $b, $c ); work( $a )

Or if work() requires the results of more_work(), then maybe:

work( $a, more_work( $b, $c ) );

I realise that your example was just that, but it demonstrates the problem with using made-up examples rather than real ones. It becomes all too easy to exaggerate the effect of the perceived problem -- that of passing lots of data around -- whilst obscuring what is often the real problem -- poorly structured code.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.