in reply to Re^2: override keywords "my" and "our"
in thread override keywords "my" and "our"
so...
my $foo = 3; my $bar = "keyword mania"; my @blivitz = "(some set of value);
within code blocks, subs, or suchlike, when you need them ...and only when you need them.
For example:
my $bar = "keyword mania"; ... (do something); ... (and something more); bax($bar); # send $bar to sub bax for further proce +ssing ...(more code) { # bare block my @blivitz = ("7", '144', '1.16', "bat",); # @blivitz values availab +le only in this block ... do something with the elements of @blivitz; } # end block sub bax { # and here's the sub, bax my $foo = "3"; ...do something to the value in $bar (a global) with $foo (availab +le only in the sub); return (something); }
Make sure you understand scoping and the issues created by making your variables global.
|
|---|