Indeed, that sentence confused me. The OP might have meant when the function is called recursively ... Here is some code for the OP that shows how to maintain a "global" variable, but not how to share variables between runs of a script.
#!/usr/bin/perl use strict; use warnings; our $outer = 5; recurse($outer); sub recurse { my $inner = shift; $inner--; return if $inner < 0; print "outer: $outer\ninner: $inner\n"; recurse($inner); }
UPDATE: You make it seem so crystal clear, holli. Oh well, here is a recursive sub in case someone needs it. :D
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to Re^2: want to create a variable whise value do not get change on recursion
by jeffa
in thread want to create a variable whise value do not get change on recursion
by sachin_chat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |