Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Humm, don't forget that Perl uses a special variable @_ for the arguments. What you can't forget is that this array @_ is global, but it's elements will change for each call. So, the performance of @_ will be similar to a global variable, but will work as a stack, so, will work for multiple calls of the same sub and recursivelly.
This code will show that: output: And forget the use of a global variable for any type of code and start learning OO. Take a look at perlobj, perltoot, perlboot and perltooc. For Object Orientation (OO) I use Class::HPLOO.
Graciliano M. P. In reply to Re: Global variable vs passing variable from sub to sub
by gmpassos
|
|