vinoth.ree has asked for the wisdom of the Perl Monks concerning the following question:
sub testing(){ foreach(@_){ print $_; } } my $subref=\&testing(1,2,3,4,6); print Dumper $subref; my $subref=\&testing;
In the above code I tried to get the reference to a subroutine, When I try the first one with parameter it called the function and the return value's reference is saved in the $subref variable
In the second one I tried without parameter the subroutine's reference saved in the $subref variable
How these two interpreted differently in Perl?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Subroutine reference
by ikegami (Patriarch) on Mar 13, 2009 at 05:15 UTC | |
|
Re: Subroutine reference
by lakshmananindia (Chaplain) on Mar 13, 2009 at 04:45 UTC | |
|
Re: Subroutine reference
by nagalenoj (Friar) on Mar 13, 2009 at 04:45 UTC | |
|
Re: Subroutine reference
by Anonymous Monk on Mar 13, 2009 at 07:22 UTC |