Bug 1: use strict; is missing. It'll show some encapsulation errors (i.e. a few missing mys).
Bug 2: use warnings; is missing. It'll show Bug 3.
Bug 3: func2 is declared after a call to it, so the prototype is ignored for that call.
Bug 4: You're using prototypes. Don't.
Bug 5: You modified $, without localizing it. (local $, = "...";)
use strict; use warnings; sub func1 { my $nums = shift; print("func1: ", join(', ', @$nums), "\n"); func2($nums); } sub func2 { my $nums = shift; print("func2: ", join(', ', @$nums), "\n"); } my @nums = (10,400,2,7,20,40,23,100,2); print("main: ", join(', ', @nums), "\n"); func1(\@nums);
In reply to Re: Can you explain me the output of this programme. especially in the subroutine func2
by ikegami
in thread Can you explain me the output of this programme. especially in the subroutine func2
by sanketkathalkar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |