http://qs321.pair.com?node_id=390592

kiat has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks,

I would like to seek your views on the merits/demerits of

(1) declaring a shared variable as global versus

(2) passing a localised variable from one subroutine to the next one that requires its value.

With (1), the variable is declared at the top level. Somewhere in the code, it gets assigned a value and that value is used by other subroutines.

With option (2), a localised variable is declared from within a subroutine. This variable is passed from this subroutine to the next one and to the ones after that which use that value.

I look forward to reading your views :)

Thanks in anticipation.